expand method
Returns a layout with a single-element axis at axis
added.
Implementation
Layout expand({int axis = 0}) {
final axis_ = checkStart(axis, rank, 'axis');
final shape_ = [...shape.take(axis_), 1, ...shape.skip(axis_)];
final strides_ = [
...strides.take(axis_),
axis_ < rank ? strides[axis_] : 1,
...strides.skip(axis_),
];
return Layout.internal(
rank: rank + 1,
length: length,
offset: offset,
shape: utils.toIndices(shape_),
strides: utils.toIndices(strides_),
isContiguous: isContiguous,
);
}