(x, base)
| 185 | |
| 186 | |
| 187 | def _tf_int(x, base): |
| 188 | if base not in (10, UNSPECIFIED): |
| 189 | raise NotImplementedError('base {} not supported for int'.format(base)) |
| 190 | |
| 191 | # TODO(mdan): We shouldn't assume int32. |
| 192 | if x.dtype == dtypes.string: |
| 193 | return gen_parsing_ops.string_to_number(x, out_type=dtypes.int32) |
| 194 | return math_ops.cast(x, dtype=dtypes.int32) |
| 195 | |
| 196 | |
| 197 | def _py_int(x, base): |