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

Function load_variable

tensorflow/python/training/checkpoint_utils.py:73–87  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

71
72@tf_export("train.load_variable")
73def 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")

Callers

nothing calls this directly

Calls 2

load_checkpointFunction · 0.70
get_tensorMethod · 0.45

Tested by

no test coverage detected