partialRangeUpTo(_:stride:)
Slice the tensor at the specified dimension.
Declaration
static func partialRangeUpTo(_ range: PartialRangeThrough<Int>, stride: Int = 1) -> any MLTensorRangeExpressionDiscussion
For example:
let x = MLTensor(randomNormal: [1, 3, 28, 28], scalarType: Float.self)
let y = x[..., ...3] // or x[..., .partialRangeThrough(...3, stride: 1)]
y.shape // is [1, 3, 28, 4]