Computes the maximum of elements across dimensions of a tensor. Reduces `input_tensor` along the dimensions given in `axis`. Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each entry in `axis`. If `keepdims` is true, the reduced dimensions are retained with length 1.
(input_tensor, axis=None, keepdims=False, name=None)
| 2174 | @tf_export("math.reduce_max", "reduce_max", v1=[]) |
| 2175 | @dispatch.add_dispatch_support |
| 2176 | def reduce_max(input_tensor, axis=None, keepdims=False, name=None): |
| 2177 | """Computes the maximum of elements across dimensions of a tensor. |
| 2178 | |
| 2179 | Reduces `input_tensor` along the dimensions given in `axis`. |
| 2180 | Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each |
| 2181 | entry in `axis`. If `keepdims` is true, the reduced dimensions |
| 2182 | are retained with length 1. |
| 2183 | |
| 2184 | If `axis` is None, all dimensions are reduced, and a |
| 2185 | tensor with a single element is returned. |
| 2186 | |
| 2187 | Args: |
| 2188 | input_tensor: The tensor to reduce. Should have real numeric type. |
| 2189 | axis: The dimensions to reduce. If `None` (the default), reduces all |
| 2190 | dimensions. Must be in the range `[-rank(input_tensor), |
| 2191 | rank(input_tensor))`. |
| 2192 | keepdims: If true, retains reduced dimensions with length 1. |
| 2193 | name: A name for the operation (optional). |
| 2194 | |
| 2195 | Returns: |
| 2196 | The reduced tensor. |
| 2197 | |
| 2198 | @compatibility(numpy) |
| 2199 | Equivalent to np.max |
| 2200 | @end_compatibility |
| 2201 | """ |
| 2202 | keepdims = False if keepdims is None else keepdims |
| 2203 | return _may_reduce_to_scalar( |
| 2204 | keepdims, axis, |
| 2205 | gen_math_ops._max( |
| 2206 | input_tensor, _ReductionDims(input_tensor, axis), keepdims, |
| 2207 | name=name)) |
| 2208 | |
| 2209 | |
| 2210 | @tf_export(v1=["math.reduce_all", "reduce_all"]) |
no test coverage detected