divsum¶
- divsum(data: Tensor, dim: tuple[int, ...] | int | None = None, keepdim: bool = False, denom: int | float | complex = 1, **kwargs: Any) Tensor[source]¶
Returns a tensor with dimensions reduced via summation then divided by a constant.
- Parameters:
data (torch.Tensor) – tensor to which operations should be applied.
dim (tuple[int, ...] | int | None, optional) – dimension(s) along which the reduction should be applied, all dimensions when
None. Defaults toNone.keepdim (bool, optional) – if the dimensions should be retained in the output. Defaults to
False.denom (int | float | complex, optional) – value by which to divide the sum. Defaults to
1.
- Returns:
dimensionally reduced tensor.
- Return type:
Tip
This is useful in cases where the mean over a larger sample is to be computed, but only a subset of the sample is being reduced.