MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / update

Method update

tensorpack/tfutils/varmanip.py:123–141  ·  view source on GitHub ↗

Args: prms(dict): dict of {variable name: value} Any name in prms must be in the graph and in vars_to_update.

(self, prms)

Source from the content-addressed store, hash-verified

121 return value
122
123 def update(self, prms):
124 """
125 Args:
126 prms(dict): dict of {variable name: value}
127 Any name in prms must be in the graph and in vars_to_update.
128 """
129 with self.sess.as_default():
130 fetches = []
131 feeds = {}
132 for name, value in six.iteritems(prms):
133 assert name in self.name_map
134 var = self.name_map[name]
135 value = SessionUpdate.relaxed_value_for_var(
136 value, var, ignore_mismatch=self.ignore_mismatch)
137 # This is the implementation of `var.load`
138 if value is not None:
139 fetches.append(var.initializer)
140 feeds[var.initializer.inputs[1]] = value
141 self.sess.run(fetches, feed_dict=feeds)
142
143
144def dump_session_params(path):

Callers 15

_run_initMethod · 0.95
_run_initMethod · 0.95
processMethod · 0.80
innerFunction · 0.80
_loadMethod · 0.80
get_tqdm_kwargsFunction · 0.80
_trigger_stepMethod · 0.80
_triggerMethod · 0.80
_triggerMethod · 0.80
get_resultMethod · 0.80
get_resultMethod · 0.80
send_dataflow_zmqFunction · 0.80

Calls 3

relaxed_value_for_varMethod · 0.80
appendMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected