vt::TensorIterator#
-
template<typename Iterator, size_t N>
class TensorIterator : public thrust::iterator_adaptor<TensorIterator<Iterator, N>, Iterator># TensorIterator class to represent an iterator of a tensor.
- Template Parameters:
Iterator – The raw iterator.
N – Number of dimensions of the tensor.
Public Functions
- inline __host__ __device__ TensorIterator (const Iterator &iter, const size_t *shape, const size_t *strides, const size_t start, const Order order, const bool contiguous)
Construct a new tensor Iterator object.
- Parameters:
iter – The raw iterator from thrust.
shape – The shape of the tensor.
strides – The strides of the tensor.
start – The start index of the tensor.
order – The order of the tensor.
contiguous – The contiguous flag of the tensor.
- inline __host__ __device__ void advance (typename thrust::iterator_difference< Iterator >::type n)
Advance the iterator by n steps. If the iterator is contiguous, used the default advance method, otherwise calculate the new index based on the strides and shape.
- Parameters:
n – Number of steps.