Type Definition easy_ml::tensors::Dimension

source ·
pub type Dimension = &'static str;
Expand description

Dimension names are represented as static string references.

This allows you to use string literals to refer to named dimensions, for example you might want to construct a tensor with a shape of [("batch", 1000), ("height", 100), ("width", 100), ("rgba", 4)].

Alternatively you can define the strings once as constants and refer to your dimension names by the constant identifiers.

const BATCH: &'static str = "batch";
const HEIGHT: &'static str = "height";
const WIDTH: &'static str = "width";
const RGBA: &'static str = "rgba";

Although Dimension is interchangable with &'static str as it is just a type alias, Easy ML uses Dimension whenever dimension names are expected to distinguish the types from just strings.