Support multiple axes in `Tensor` reduce methods
haydnv opened this issue · comments
i.e. min
, max
, sum
, product
Example:
# ...
@tc.post
def average(tensor, *axes):
assert hasattr(axes, "__len__")
if axes:
return tensor.sum(axes) / functools.reduce(operator.mul, tensor.shape[x] for x in axes)
else:
return tensor.sum() / tensor.size