Function nvcvTensorCalcRequirements

Function Documentation

NVCVStatus nvcvTensorCalcRequirements(int32_t rank, const int64_t *shape, NVCVDataType dtype, NVCVTensorLayout layout, int32_t baseAddrAlignment, int32_t rowAddrAlignment, NVCVTensorRequirements *reqs)

Calculates the resource requirements needed to create a tensor with given shape.

Parameters:
  • rank[in] Rank of the tensor (its number of dimensions).

  • shape[in] Pointer to array with tensor shape. It must contain at least ‘rank’ elements.

  • dtype[in] Type of tensor’s elements.

  • layout[in] Tensor layout. Pass NVCV_TENSOR_NONE is layout is not available.

    • Layout rank must be rank.

  • baseAddrAlignment[in] Alignment, in bytes, of the requested memory buffer. If 0, use a default suitable for optimized memory access. The used alignment is at least the given value.

    • If different from 0, it must be a power-of-two.

  • rowAddrAlignment[in] Alignment, in bytes, of the start of each second-to-last dimension address. If 0, use a default suitable for optimized memory access. The used alignment is at least the given value. Pass 1 for creation of fully packed tensors, i.e., no padding between dimensions.

    • If different from 0, it must be a power-of-two.

  • reqs[out] Where the tensor requirements will be written to.

    • Must not be NULL.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside valid range.

  • NVCV_SUCCESS – Operation executed successfully.