Returns the filepath value stored in constant `path_tensor`.
(self, path_tensor)
| 319 | return export_dir |
| 320 | |
| 321 | def _file_path_value(self, path_tensor): |
| 322 | """Returns the filepath value stored in constant `path_tensor`.""" |
| 323 | if not isinstance(path_tensor, ops.Tensor): |
| 324 | raise TypeError("tensor is not a Tensor") |
| 325 | if path_tensor.op.type != "Const": |
| 326 | raise TypeError("Only constants tensor are supported") |
| 327 | if path_tensor.dtype != dtypes.string: |
| 328 | raise TypeError("File paths should be string") |
| 329 | str_value = path_tensor.op.get_attr("value").string_val |
| 330 | if len(str_value) != 1: |
| 331 | raise TypeError("Only scalar tensors are supported") |
| 332 | return str_value[0] |