Id of the bucket holding the data for this tensor. Multiple arrays can point to the same bucket (e.g. when calling array.reshape()).
Readonly
dtypeThe data type for the array.
Readonly
idUnique id of this tensor.
Whether this tensor has been globally kept.
Optional
kerasThe keras mask that some keras layers attach to the tensor
Readonly
rankThe rank type for the array (see Rank
enum).
The id of the scope this tensor is being tracked in.
Readonly
shapeThe shape of the tensor.
Readonly
sizeNumber of elements in the tensor.
Readonly
stridesNumber of elements to skip in each dimension when indexing. See https://docs.scipy.org/doc/numpy/reference/generated/\ numpy.ndarray.strides.html
Assign a new tf.Tensor
to this variable. The new tf.Tensor
must have
the same shape and dtype as the old tf.Tensor
.
New tensor to be assigned to this variable.
Returns a promise of tf.TensorBuffer
that holds the underlying data.
Returns a tf.TensorBuffer
that holds the underlying data.
Returns a copy of the tensor. See tf.clone
for details.
Copy the tensor's data to a new GPU resource. Comparing to the dataSync()
and data()
, this method prevents data from being downloaded to CPU.
For WebGL backend, the data will be stored on a densely packed texture. This means that the texture will use the RGBA channels to store value.
For WebGPU backend, the data will be stored on a buffer. There is no parameter, so can not use a user-defined size to create the buffer.
Optional
options: DataToGPUWebGLOptionFor WebGL backend, a GPUData contains the new texture and its information. { tensorRef: The tensor that is associated with this texture, texture: WebGLTexture, texShape: [number, number] // [height, width] }
For WebGPU backend, a GPUData contains the new buffer.
{
tensorRef: The tensor that is associated with this buffer,
buffer: GPUBuffer,
}
Remember to dispose the GPUData after it is used by
`res.tensorRef.dispose()`.
Generated using TypeDoc
A mutable
tf.Tensor
, useful for persisting state, e.g. for training.Doc