MCPcopy Index your code
hub / github.com/tensorflow/tfjs / bytes

Method bytes

tfjs-core/src/tensor.ts:428–436  ·  view source on GitHub ↗

Returns the underlying bytes of the tensor's data.

()

Source from the content-addressed store, hash-verified

426
427 /** Returns the underlying bytes of the tensor's data. */
428 async bytes(): Promise<Uint8Array[]|Uint8Array> {
429 this.throwIfDisposed();
430 const data = await trackerFn().read(this.dataId);
431 if (this.dtype === 'string') {
432 return data as Uint8Array[];
433 } else {
434 return new Uint8Array((data as TypedArray).buffer);
435 }
436 }
437
438 /**
439 * Disposes `tf.Tensor` from memory.

Callers 3

tensor_test.tsFile · 0.80
encodeWeightsFunction · 0.80
compiled_api.jsFile · 0.80

Calls 2

throwIfDisposedMethod · 0.95
readMethod · 0.65

Tested by

no test coverage detected