# @tensorflow/tfjs-backend-cpu

> Vanilla JavaScript backend for TensorFlow.js

Latest version **4.22.0** (published 2024-10-21) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @tensorflow/tfjs-backend-cpu
pnpm add @tensorflow/tfjs-backend-cpu
yarn add @tensorflow/tfjs-backend-cpu
bun add @tensorflow/tfjs-backend-cpu
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score; popular repo.

Warnings: low downloads; large bundle.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 4.22.0 |
| Published | 2024-10-21 |
| First published | 2020-04-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19141 |
| Maintainers | delhibabu, laxma4675, fengwuyao, linchan, pyu10055, caisq, annxingyuan, linazhao128, mattsoulanille, jinjingforever |

## Links

- npm: https://www.npmjs.com/package/@tensorflow/tfjs-backend-cpu
- Repository: https://github.com/tensorflow/tfjs
- Homepage: https://github.com/tensorflow/tfjs#readme
- Issues: https://github.com/tensorflow/tfjs/issues
- npm.io page: https://npm.io/package/@tensorflow/tfjs-backend-cpu

## Dependencies (2)

- [seedrandom](https://npm.io/package/seedrandom.md) ^3.0.5
- [@types/seedrandom](https://npm.io/package/@types/seedrandom.md) ^2.4.28

## Recent versions

- 4.22.0 (latest) — 2024-10-21
- 4.23.0-rc.0 (next) — 2025-01-08
- 4.22.0-rc.0 — 2024-10-14
- 4.21.0 — 2024-09-03
- 4.21.0-rc.0 — 2024-08-26
- 4.20.0 — 2024-06-03
- 4.20.0-rc.0 — 2024-05-28
- 4.19.0 — 2024-04-30
- 4.19.0-rc.0 — 2024-04-24
- 4.18.0 — 2024-04-17
- 4.18.0-rc.0 — 2024-04-11
- 4.17.0 — 2024-01-30
- 4.17.0-rc.0 — 2024-01-23
- 4.16.0 — 2024-01-11
- 4.16.0-rc.0 — 2024-01-09
- … 63 more at https://npm.io/package/@tensorflow/tfjs-backend-cpu/versions

## README

# Usage

This package implements a JavaScript based CPU backend to TensorFlow.js.

## Importing the backend

Note: this backend is included by default in `@tensorflow/tfjs`.

### Via NPM

```js
// Import @tensorflow/tfjs-core
import * as tf from '@tensorflow/tfjs-core';
// Adds the CPU backend to the global backend registry.
import '@tensorflow/tfjs-backend-cpu';
```

### Via a script tag

```html
<!-- Import @tensorflow/tfjs-core -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>

<!-- Adds the CPU backend to the global backend registry -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu"></script>
```

You can also get ES2017 code using the following links

```html
<!-- Import @tensorflow/tfjs-core -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core@2.0.0-rc.4/dist/tf-core.es2017.js"></script>

<!-- Adds the CPU backend to the global backend registry -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu@2.0.0-rc.4/dist/tf-backend-cpu.es2017.js"></script>
```

---
_Source: https://npm.io/package/@tensorflow/tfjs-backend-cpu · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
