Returns the tensor value of the given variable in the checkpoint. Args: ckpt_dir_or_file: Directory with checkpoints file or path to checkpoint. name: Name of the variable to return. Returns: A numpy `ndarray` with a copy of the value of this variable.
(ckpt_dir_or_file, name)
| 71 | |
| 72 | @tf_export("train.load_variable") |
| 73 | def load_variable(ckpt_dir_or_file, name): |
| 74 | """Returns the tensor value of the given variable in the checkpoint. |
| 75 | |
| 76 | Args: |
| 77 | ckpt_dir_or_file: Directory with checkpoints file or path to checkpoint. |
| 78 | name: Name of the variable to return. |
| 79 | |
| 80 | Returns: |
| 81 | A numpy `ndarray` with a copy of the value of this variable. |
| 82 | """ |
| 83 | # TODO(b/29227106): Fix this in the right place and remove this. |
| 84 | if name.endswith(":0"): |
| 85 | name = name[:-2] |
| 86 | reader = load_checkpoint(ckpt_dir_or_file) |
| 87 | return reader.get_tensor(name) |
| 88 | |
| 89 | |
| 90 | @tf_export("train.list_variables") |
nothing calls this directly
no test coverage detected