MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / max

Method max

tensorflow/python/framework/dtypes.py:201–222  ·  view source on GitHub ↗

Returns the maximum representable value in this data type. Raises: TypeError: if this is a non-numeric, unordered, or quantized type.

(self)

Source from the content-addressed store, hash-verified

199
200 @property
201 def max(self):
202 """Returns the maximum representable value in this data type.
203
204 Raises:
205 TypeError: if this is a non-numeric, unordered, or quantized type.
206
207 """
208 if (self.is_quantized or
209 self.base_dtype in (bool, string, complex64, complex128)):
210 raise TypeError("Cannot find maximum value of %s." % self)
211
212 # there is no simple way to get the max value of a dtype, we have to check
213 # float and int types separately
214 try:
215 return np.finfo(self.as_numpy_dtype()).max
216 except: # bare except as possible raises by finfo not documented
217 try:
218 return np.iinfo(self.as_numpy_dtype()).max
219 except:
220 if self.base_dtype == bfloat16:
221 return _np_bfloat16(float.fromhex("0x1.FEp127"))
222 raise TypeError("Cannot find maximum value of %s." % self)
223
224 @property
225 def limits(self, clip_negative=True):

Callers 15

_optimizeFunction · 0.45
prepare_dataFunction · 0.45
prepare_dataFunction · 0.45
prepare_dataFunction · 0.45
prepare_dataFunction · 0.45
testImageSummaryMethod · 0.45
SimpleSparseTensorFromFunction · 0.45
_compareMethod · 0.45
testFloat32MaxMethod · 0.45

Calls 1

as_numpy_dtypeMethod · 0.95

Tested by 15

testImageSummaryMethod · 0.36
SimpleSparseTensorFromFunction · 0.36
_compareMethod · 0.36
testFloat32MaxMethod · 0.36
_verifySolveMethod · 0.36
TestFunction · 0.36
testRangeMethod · 0.36
testUniformIntsMethod · 0.36
run_testMethod · 0.36