default
fast-tensor / default
Variable: default
const
default:object
Type declaration
General
Kalman
Kalman: typeof
Kalman
ready()
ready: () =>
Promise
<void
>
Returns
Promise
<void
>
setWasmPath()
setWasmPath: (
path
) =>Promise
<void
>
Parameters
path
string
Returns
Promise
<void
>
tensor()
tensor: (
data
?,shape
?) =>Tensor
Parameters
data?
shape?
Returns
Tensor
Tensor: typeof
Tensor
Performance / Memory
beginScope()
beginScope: () =>
void
Start a scope to track any instances created. Should be used with ft.endScope()
.
See ft.scope() for a simpler approach.
Returns
void
Example
ft.beginScope();
const a = tf.ones([2,2]);
const b = a.add(2);
const result = b.data();
ft.endScope();
// a and b will have been freed from memory
endScope()
endScope: () =>
void
End a scope of tracked instances. Should be used with ft.beginScope()
.
See ft.scope() for a simpler approach.
Returns
void
Example
ft.beginScope();
const a = tf.ones([2,2]);
const b = a.add(2);
const result = b.data();
ft.endScope();
// a and b will have been freed from memory
scope()
scope: (
callback
?) =>unknown
Start a scope to track any instances created, will automatically clear out any references not returned.
Parameters
callback?
() => unknown
Returns
unknown
Examples
ft.scope(() => {
const a = tf.ones([2,2]);
const b = a.add(2);
const result = b.data();
return result;
});
// "a" and "b" will have been freed from memory
const result = ft.scope(() => {
const a = tf.ones([2,2]);
const b = a.add(2);
return b;
});
// only "a" will have been freed from memory
// you will need to manually delete the instance
result.delete();