Structures
The following structures are available globally.
-
Corresponding to
See moreBatchNormInfo
in metal fileDeclaration
Swift
public struct BatchNormInfo
-
Mirror struct of
See morePool2DInfo
inpooling_op.metal
Declaration
Swift
public struct Pool2DInfo
-
Corresponding struct of
See moreConvInfo
in Metal filesDeclaration
Swift
public struct ConvInfo
-
Corresponding struct
See moreImg2ColInfo
in img2col_op.metalDeclaration
Swift
public struct Img2ColInfo
-
Undocumented
See moreDeclaration
Swift
public struct TransposeMatrixInfo
-
This struct corresponds to the
See moreMatrixDimInfo
struct in file ‘matrix_mult_op.metal’Declaration
Swift
public struct MatrixDimInfo
-
The tensor shape description. Specify the shape and data type of a
Tensor
data object.## dataType Indicate the initial set data type.
## shapeArray The
shape
attrribute defines the dimension of aTensor
object. Inserrano
, we followrow-marjor
order to store and access elements in aTensor
object and each row is represented as an array. For a given shape array withn
indices[i_0, i_1, ..., i_(n-1)]
, each index fromi_0
toi_(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, aTensorShape
object withshpae
as[2, 1, 3]
. It’s 1st dimension has2
rows in which each row has1
row with 3 elements.User should be clear and unserstanding what a
Tensor
object looks like when they passing in aTensorShape
argument. For example, aTensor
object 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] ] ]
Equatable
Two TensorShape objects are equal (
==
)if they have the sameshape
.Two TensorShape objects are dot equal (
.==
) if they have the sameshape
and samedataType
.Rank is
0
If a
See moreTensor
object’s shapeArray has0
rank, it indicates that it just contains a scalar value.Declaration
Swift
public struct TensorShape: Equatable, Comparable