def _largest_integer_by_dtype(dt):
if not _is_known_dtype(dt):<EOL><INDENT>raise TypeError("<STR_LIT>".format(dt.name))<EOL><DEDENT>if dt.is_floating:<EOL><INDENT>return int(<NUM_LIT:2>**(np.finfo(dt.as_numpy_dtype).nmant + <NUM_LIT:1>))<EOL><DEDENT>if dt.is_integer:<EOL><INDENT>return np.iinfo(dt.as_numpy_dtype).max<EOL><DEDENT>if dt.base_dtype == tf.bool:<EOL><INDENT>return int(<NUM_LIT:1>)<EOL><DEDENT>raise TypeError("<STR_LIT>".format(dt.name))<EOL>
Helper returning the largest integer exactly representable by dtype.