oneflow.amax¶
-
oneflow.
amax
(input, dim=None, keepdim=False) → Tensor¶ Returns the maximum along a dimension.
This function is equivalent to PyTorch’s amax function.
- Parameters
input (oneflow.Tensor) – the input Tensor.
dim (int or List of int, optional) – the dimension or the dimensions to reduce. Dim is None by default.
keepdim (bool, optional) – whether to retain the dimension. keepdim is False by default.
- Returns
Maximum of the input tensor
- Return type
For example:
>>> import oneflow as flow >>> x = flow.tensor([[[0,1],[2,3]],[[4,5],[6,7]]]) >>> flow.amax(x, 1) tensor([[2, 3], [6, 7]], dtype=oneflow.int64) >>> flow.amax(x, 0) tensor([[4, 5], [6, 7]], dtype=oneflow.int64) >>> flow.amax(x) tensor(7, dtype=oneflow.int64) >>> flow.amax(x, 0, True) tensor([[[4, 5], [6, 7]]], dtype=oneflow.int64)