MLArrayType

class NatML.Types.MLArrayType : MLFeatureType

This feature type describes multidimensional arrays or tensors.

Creating the Type

/// <summary>
/// Create an array feature type.
/// </summary>
/// <param name="type">Array element type.</param>
/// <param name="shape">Array feature shape.</param>
MLArrayType (Type type, int[] shape);

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:

/// <summary>
/// Create an array feature type.
/// </summary>
/// <param name="name">Feature name.</param>
/// <param name="type">Array element type.</param>
/// <param name="shape">Array feature shape.</param>
MLArrayType (string name, Type type, int[] shape);

Inspecting the Type

/// <summary>
/// Feature name.
/// </summary>
string name { get; }

/// <summary>
/// Feature data type.
/// This will typically be a numeric type.
/// </summary>
Type dataType { get; }

Refer to the MLFeatureType class for more information.

Inspecting the Shape

/// <summary>
/// Array shape.
/// </summary>
int[] shape { get; }

The array type provides the shape of its corresponding feature.

Dimensions

/// <summary>
/// Array dimensions.
/// </summary>
int dims { get; }

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

/// <summary>
/// Array element count.
/// </summary>
int elementCount { get; }

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 updated