Class TensorBatch
Defined in File TensorBatch.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public nvcv::CoreResource< NVCVTensorBatchHandle, TensorBatch >
(Template Class CoreResource)
Class Documentation
-
class TensorBatch : public nvcv::CoreResource<NVCVTensorBatchHandle, TensorBatch>
Handle to a tensor batch object.
Tensor batch is a container type that can hold a list of non-uniformly shaped tensors. Rank, data type and layout must be consistent between the tensors.
Public Types
-
using Base = CoreResource<NVCVTensorBatchHandle, TensorBatch>
-
using Requirements = NVCVTensorBatchRequirements
-
using HandleType = NVCVTensorBatchHandle
Public Functions
-
inline TensorBatch(const TensorBatch &other)
-
inline TensorBatch(TensorBatch &&other)
-
inline TensorBatch &operator=(const TensorBatch &other)
-
inline TensorBatch &operator=(TensorBatch &&other)
-
inline TensorBatch(const Requirements &reqs, const Allocator &alloc = nullptr)
-
inline int32_t rank() const
Return the rank of the tensors in the tensor batch or -1 for an empty batch.
-
inline TensorLayout layout() const
Return the layout of the tensors in the tensor batch.
-
inline NVCVTensorBufferType type() const
Return the buffer type of the tensors’ data.
-
template<typename It>
inline void pushBack(It begin, It end) Append tensors from the given range to the end of the batch.
- Parameters:
begin, end – range of the tensors to append.
-
inline void pushBack(const Tensor &tensor)
Append the tensor to the end of the batch.
- Parameters:
tensor – Appended tensor.
-
inline void popTensors(int32_t numTensors)
Truncate tensors from the end of the batch.
- Parameters:
numTensors – Number of tensors to remove.
-
inline void popTensor()
Delete the last tensor from the batch.
-
inline TensorBatchData exportData(CUstream stream)
Generate the tensor batch data descriptor.
The necessary copies to GPU are scheduled on the given stream. The struct is valid after the scheduled work is finished.
- Parameters:
stream – CUDA stream on which the buffers copy will be scheduled.
-
inline void clear()
-
inline void setUserPointer(void *ptr)
Associates a user pointer to the tensor batch.
- Parameters:
ptr – User pointer
-
inline void *getUserPointer() const
Get the user pointer that was previously assciated to the tensor batch with the setUserPointer(void*) method. Returns nullptr if no pointer was set.
Public Static Functions
-
static inline Requirements CalcRequirements(int32_t capacity)
-
class Iterator
Public Types
-
using iterator_category = std::random_access_iterator_tag
Public Functions
-
inline Iterator operator+(difference_type diff) const
-
inline Iterator operator-(difference_type diff) const
-
inline difference_type operator-(const Iterator &rhs) const
-
using iterator_category = std::random_access_iterator_tag
-
using Base = CoreResource<NVCVTensorBatchHandle, TensorBatch>