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
Optional
offset: Tensor<R> | TensorLike | Tensor1DOptional
scale: Tensor<R> | TensorLike | Tensor1DOptional
varianceEpsilon: numberOptional
dataFormat: "NWC" | "NCW"Optional
dilation: numberOptional
dimRoundingMode: "floor" | "round" | "ceil"Optional
dataFormat: "NHWC" | "NCHW"Optional
dilations: number | [number, number]Optional
dimRoundingMode: "floor" | "round" | "ceil"Optional
dimRoundingMode: "floor" | "round" | "ceil"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()`.
Optional
dataFormat: "NHWC" | "NCHW"Optional
dilations: number | [number, number]Optional
dimRoundingMode: "floor" | "round" | "ceil"Optional
diationRate: number | [number, number]Optional
strides: number | [number, number]Optional
dimRoundingMode: "floor" | "round" | "ceil"Optional
dilation: number | [number, number]Optional
dataFormat: "NHWC" | "NCHW"
A
tf.Tensor
object represents an immutable, multidimensional array of numbers that has a shape and a data type.For performance reasons, functions that create tensors do not necessarily perform a copy of the data passed to them (e.g. if the data is passed as a
Float32Array
), and changes to the data will change the tensor. This is not a feature and is not supported. To avoid this behavior, use the tensor before changing the input data or create a copy withcopy = tf.add(yourTensor, 0)
.See
tf.tensor
for details on how to create atf.Tensor
.Doc