# tfjs-shapes

> Backend for Tensorflow.js that just computes tensor shapes and dtypes

Latest version **0.0.10** (published 2018-07-26) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install tfjs-shapes
pnpm add tfjs-shapes
yarn add tfjs-shapes
bun add tfjs-shapes
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2018-07-26 |
| First published | 2018-07-24 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 108.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | aman-tiwari |
| Keywords | machine learning, tensorflow, tfjs, ml, tensorflow.js, shapes |

## Links

- npm: https://www.npmjs.com/package/tfjs-shapes
- Homepage: https://github.com/aman-tiwari/tfjs-shapes
- npm.io page: https://npm.io/package/tfjs-shapes

## Dependencies (1)

- [@tensorflow/tfjs-core](https://npm.io/package/@tensorflow/tfjs-core.md) ^0.12.5

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 0.0.10 (latest) — 2018-07-26
- 0.0.9 — 2018-07-24
- 0.0.8 — 2018-07-24
- 0.0.7 — 2018-07-24
- 0.0.6 — 2018-07-24
- 0.0.5 — 2018-07-24
- 0.0.4 — 2018-07-24
- 0.0.3 — 2018-07-24
- 0.0.2 — 2018-07-24

## README

# Tensorflow.js Shape Backend

This is a backend for [Tensorflow.js](https://github.com/tensorflow/tfjs) that just computes the shapes and dtypes of tensors. 

This could be used to build an editor extension that lets you get the shape of a tensor on hover, or to build asynchronous computation backends (Tensorflow.js needs to know the shape of tensors synchronously, but is fine with the actual computation being asynchronous).


## Usage


```js
import * as tf from '@tensorflow/tfjs'
import 'tfjs-shapes'

tf.setBackend('tfjs-shapes')

const ones = tf.ones([10, 10, 10, 10])
const pooled = tf.maxPool(ones, 2, 2, 'same')

console.log(pooled)
/** should print something like
 * Tensor {
  isDisposedInternal: false,
  size: 2500,
  shape: [ 10, 5, 5, 10 ],
  dtype: 'float32',
  strides: [ 250, 50, 10 ],
  dataId: {},
  id: 3,
  rankType: '4' }
  */

```

Or

```js
import { shapesOnly } from 'tfjs-shapes'

const { shape, dtype } = shapesOnly(() => {
    const ones = tf.ones([10, 10, 10, 10])
    const pooled = tf.maxPool(ones, 2, 2, 'same')
    return pooled
})
// shape === [10, 5, 5, 10]
// dtype === 'float32'

```



### TODO

* Implement 
    * BatchToSpaceND & SpaceToBatchND
* More tests
* Better name for `shapesOnly`

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