Reductions

Reduction operations like sums on tensors.

CudaTensor *augpy::sum(CudaTensor *tensor, bool upcast)

Sum all elements in a tensor with saturation.

Return

sum value as scalar tensor

Parameters
  • tensor: tensor to sum, must be contiguous

  • upcast: if true, returns temp dtype

CudaTensor *augpy::sum_axis(CudaTensor *tensor, int axis, bool keepdim = false, bool upcast = false, CudaTensor *out = nullptr, unsigned int blocks_per_sm = BLOCKS_PER_SM, unsigned int num_threads = 512)

Sum of all elements along an axis in a tensor with saturation.

Return

new tensor with values summed along axis if out is NULL, else out

Parameters
  • tensor: tensor to sum, may be strided

  • axis: axis index to sum along

  • keepdim: if true, keep sum axis dimension with length 1

  • upcast: if true, returns tensor with temp dtype

  • out: output tensor (may be NULL), must have correct shape

  • blocks_per_sm:

  • num_threads:

CudaTensor *augpy::all(CudaTensor *tensor)

Check whether all elements in a tensor are greater zero.

Return

0 or 1 as scalar uint8 tensor

Parameters
  • tensor: tensor to sum, must be contiguous