Id of the bucket holding the data for this tensor. Multiple arrays can point to the same bucket (e.g. when calling array.reshape()).
ReadonlydtypeThe data type for the array.
ReadonlyidUnique id of this tensor.
Whether this tensor has been globally kept.
OptionalkerasThe keras mask that some keras layers attach to the tensor
ReadonlyrankThe rank type for the array (see Rank enum).
The id of the scope this tensor is being tracked in.
ReadonlyshapeThe shape of the tensor.
ReadonlysizeNumber of elements in the tensor.
ReadonlystridesNumber of elements to skip in each dimension when indexing. See https://docs.scipy.org/doc/numpy/reference/generated/\ numpy.ndarray.strides.html
OptionaldimRoundingMode: "floor" | "round" | "ceil"Optionaloffset: tf.Tensor<R> | Tensor1D | TensorLikeOptionalscale: tf.Tensor<R> | Tensor1D | TensorLikeOptionalvarianceEpsilon: numberOptionaldataFormat: "NWC" | "NCW"Optionaldilation: numberOptionaldimRoundingMode: "floor" | "round" | "ceil"OptionaldataFormat: "NHWC" | "NCHW"Optionaldilations: number | [number, number]OptionaldimRoundingMode: "floor" | "round" | "ceil"OptionaldimRoundingMode: "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.
Optionaloptions: 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()`.
OptionaldataFormat: "NHWC" | "NCHW"Optionaldilations: number | [number, number]OptionaldimRoundingMode: "floor" | "round" | "ceil"Optionaldilations: number | [number, number]OptionaldataFormat: "NHWC"OptionaldimRoundingMode: "floor" | "round" | "ceil"OptionaldiationRate: number | [number, number]Optionalstrides: number | [number, number]OptionaldimRoundingMode: "floor" | "round" | "ceil"Optionaldilation: number | [number, number]OptionaldataFormat: "NHWC" | "NCHW"
A
tf.Tensorobject 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.tensorfor details on how to create atf.Tensor.Doc