# Running tensorflow-core in node js

**URL:** <https://discuss.ai.google.dev/t/running-tensorflow-core-in-node-js/26504>\
**Category:** TF.js\
**Tags:** help\_request\
**Created:** [September 4, 2023, 7:41am UTC](https://discuss.ai.google.dev/t/running-tensorflow-core-in-node-js/26504 "2023-09-04T07:41:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mah\_Neh](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/mah_neh/32/11663_2.png) [@Mah\_Neh](https://discuss.ai.google.dev/u/Mah_Neh)\
**Post date:** [September 4, 2023, 7:41am UTC](https://discuss.ai.google.dev/t/running-tensorflow-core-in-node-js/26504/1 "2023-09-04T07:41:14Z")

</div>

1. To avoid the large size of tfjs (140MB),
2. since we do not need the layers api,
3. we want to install `tfjs-core` which is just 30MB and then get the cpu-backend.

However, would this run at the same speed than `tfjs-node` ? If not I presume it’s because of the C bindings, but can these be imported separately ?

---

<div class="post-metadata">

**Author:** ![Aniket\_Dubey](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/aniket_dubey/32/16664_2.png) [@Aniket\_Dubey](https://discuss.ai.google.dev/u/Aniket_Dubey)\
**Post date:** [August 27, 2024, 4:03am UTC](https://discuss.ai.google.dev/t/running-tensorflow-core-in-node-js/26504/3 "2024-08-27T04:03:08Z")

</div>

Hi @Mah_Neh ,

> [@Mah\_Neh](#):
>
> would this run at the same speed than `tfjs-node` ?

No, it would not run at the same speed as `tfjs-node`. There are a few reasons for this:

1. `tfjs-node` uses native C++ bindings to the TensorFlow C library, which provides significant performance benefits.
2. The CPU backend that comes with `tfjs-core` is implemented in JavaScript, which is generally slower for numerical computations compared to native C++ code.

> [@Mah\_Neh](#):
>
> If not I presume it’s because of the C bindings, but can these be imported separately

Yes, the C bindings can be imported separately, but it’s not as straightforward as just importing another JavaScript module. The C bindings are part of what makes `tfjs-node` fast.

Use `@tensorflow/tfjs-node-gpu` or `@tensorflow/tfjs-node`: These packages include the C++ bindings and will give you the best performance .

Hope this helps ,

Thank You .
