Implementing kernel
C++ engine symbols that back this Python API.Return a slice of input along dim.
Equivalent to input[..., start:start+length, ...] with the slice
applied at position dim. On the CPU the slice is a view of
input's buffer — along a later axis a non-contiguous one; on metal
it is a copy.
Parameters
inputTensorSource tensor.
dimintDimension to slice.
startintFirst index (inclusive).
lengthintNumber of elements to take. Must satisfy
start + length <= input.size(dim).Returns
TensorThe slice, of size length along dim.
Notes
Unlike NumPy slicing, narrow accepts only step 1; for general
strided slicing use indexing syntax.
Examples
>>> import lucid
>>> x = lucid.arange(10)
>>> lucid.narrow(x, dim=0, start=3, length=4)
Tensor([3, 4, 5, 6])