Macros
macro `[]`[T](t: AnyTensor[T]; args: varargs[untyped]): untyped
-
Slice a Tensor or a CudaTensor Input:
- a Tensor or a CudaTensor
- and:
- specific coordinates (varargs[int])
- or a slice (cf. tutorial)
- or a boolean tensor or openArray mask with the same shape as the tensor
Returns:
- a value or a tensor corresponding to the slice or to the true elements of the mask
Warning âš CudaTensor temporary default: For CudaTensor only, this is a no-copy operation, data is shared with the input. This proc does not guarantee that a let value is immutable. Usage:
- Basic indexing - foo2, 3
- Basic indexing - foo1+1, 2*2*1
- Basic slicing - foo1..2, 3
- Basic slicing - foo1+1..4, 3-2..2
- Span slices - foo_, 3
- Span slices - foo1.._, 3
- Span slices - foo_..3, 3
- Span slices - foo_.._, 3
- Stepping - foo1..3\|2, 3
- Span stepping - foo_.._\|2, 3
- Span stepping - foo_.._\|+2, 3
- Span stepping - foo1.._\|1, 2..3
- Span stepping - foo_..<4\|2, 3
- Slicing until at n from the end - foo0..^4, 3
- Span Slicing until at n from the end - foo_..^2, 3
- Stepped Slicing until at n from the end - foo1..^1\|2, 3
- Slice from the end - foo^1..0\|-1, 3
- Slice from the end - expect non-negative step error - foo^1..0, 3
- Slice from the end - foo^(2*2)..2*2, 3
- Slice from the end - foo^3..^2, 3
- Items matching a mask - foofoo >. 0