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 contiguousupcast
: iftrue
, 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
isNULL
, elseout
- Parameters
tensor
: tensor to sum, may be stridedaxis
: axis index to sum alongkeepdim
: iftrue
, keep sum axis dimension with length 1upcast
: iftrue
, returns tensor with temp dtypeout
: output tensor (may beNULL
), must have correct shapeblocks_per_sm
:num_threads
:
-
CudaTensor *
augpy
::
all
(CudaTensor *tensor)¶ Check whether all elements in a tensor are greater zero.
- Return
0
or1
as scalaruint8
tensor- Parameters
tensor
: tensor to sum, must be contiguous