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

Method set_value

tensorpack/callbacks/param.py:78–84  ·  view source on GitHub ↗

Assign the variable a new value.

(self, v)

Source from the content-addressed store, hash-verified

76 raise ValueError("{} is not a variable in the graph!".format(self.var_name))
77
78 def set_value(self, v):
79 """ Assign the variable a new value. """
80 if not self.var.dtype.is_floating and isinstance(v, float):
81 raise ValueError(
82 "HyperParam {} has type '{}'. Cannot update it using float values.".format(
83 self.name, self.var.dtype))
84 self.var.load(v)
85
86 def get_value(self):
87 """ Evaluate the variable. """

Callers

nothing calls this directly

Calls 2

formatMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected