The following structures are available globally.
The tensor shape description. Specify the shape and data type of a
## dataType Indicate the initial set data type.
## shapeArray The
shapeattrribute defines the dimension of a
serrano, we follow
row-marjororder to store and access elements in a
Tensorobject and each row is represented as an array. For a given shape array with
[i_0, i_1, ..., i_(n-1)], each index from
i_(n-2)defines the number of rows in its previous dimension. The last index define the number of elements in its previous dimention. For example, a
[2, 1, 3]. It’s 1st dimension has
2rows in which each row has
1row with 3 elements.
User should be clear and unserstanding what a
Tensorobject looks like when they passing in a
TensorShapeargument. For example, a
Tensorobject with shape
[2, 3], it can be visulized as a nested array like below:
// shape [2, 3] [ [1.0, 0.5, 1.3], [2.0, 4.2, 6.7], ]
And a typical real-world example, a 3-channel RGB image data could be represented with shape
[3, image_hight, image_width]:
[ // R channel frame [ [232, ..., 123], // (# of Int elements) = image_width . . . [113, ..., 225] ], // (# of Array elements) = image_hight // G channel frame [ [232, ..., 123], . . . [113, ..., 225] ], // B channel frame [ [232, ..., 123], . . . [113, ..., 225] ] ]
Two TensorShape objects are equal (
==)if they have the same
Two TensorShape objects are dot equal (
.==) if they have the same
If aSee more
Tensorobject’s shapeArray has
0rank, it indicates that it just contains a scalar value.
public struct TensorShape: Equatable, Comparable