megengine.Parameter.max¶
- Parameter.max(axis=None, keepdims=False)¶
Returns the max value of each row of the input tensor in the given dimension
axis.If
axisis a list of axises, reduce over all of them. IfkeepdimsisTrue, the shape of output tensor is the same as the input tensor, except in the dimension(s)axiswhere it is of size 1. Otherwise,axisis squeezed (seesqueeze).- 参数
axis – the dimension or dimensions to reduce.
keepdims (
bool) – 输出张量是否保留了轴 ndim 。
- 返回
输出张量。
实际案例
from megengine import tensor a = tensor([False, True, True, False]) b = tensor([1.0, 2.0, 3.0, 4.0]) print(a.max().numpy()) print(b.max().numpy())
输出:
True 4.0