NatML
Search…
MLArrayType
class NatSuite.ML.Types.MLArrayType : MLFeatureType
This feature type describes multidimensional arrays or tensors.

Creating the Type

1
/// <summary>
2
/// Create an array feature type.
3
/// </summary>
4
/// <param name="type">Array element type.</param>
5
/// <param name="shape">Array feature shape.</param>
6
MLArrayType (Type type, int[] shape);
Copied!
An array type is created with a data type and a corresponding shape.
Even though array types can be created without a shape, this should be avoided.
There is another constructor which accepts a feature name:
1
/// <summary>
2
/// Create an array feature type.
3
/// </summary>
4
/// <param name="name">Feature name.</param>
5
/// <param name="type">Array element type.</param>
6
/// <param name="shape">Array feature shape.</param>
7
MLArrayType (string name, Type type, int[] shape);
Copied!

Inspecting the Type

1
/// <summary>
2
/// Feature name.
3
/// </summary>
4
string name { get; }
5
6
/// <summary>
7
/// Feature data type.
8
/// This will typically be a numeric type.
9
/// </summary>
10
Type dataType { get; }
Copied!
Refer to the MLFeatureType class for more information.

Inspecting the Shape

1
/// <summary>
2
/// Array shape.
3
/// </summary>
4
int[] shape { get; }
Copied!
The array type provides the shape of its corresponding feature.

Dimensions

1
/// <summary>
2
/// Array dimensions.
3
/// </summary>
4
int dims { get; }
Copied!
The type provides a convenience property for the number of dimensions which the array feature has.
This is always the number of elements in the shape.

Element Count

1
/// <summary>
2
/// Array element count.
3
/// </summary>
4
int elementCount { get; }
Copied!
The type provides a convenience property for the number of elements which the array feature has.
This is always the product of the elements in the shape.
Last modified 29d ago