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