MCPcopy Create free account
hub / github.com/apache/singa / set_states

Method set_states

python/singa/layer.py:155–169  ·  view source on GitHub ↗

Set states for this layer and all sublayers Args: states(dict): A dictionary contains state names and corresponding values. The value shoud be either a PyTensor or numpy ndarray

(self, states)

Source from the content-addressed store, hash-verified

153 return states
154
155 def set_states(self, states):
156 """ Set states for this layer and all sublayers
157
158 Args:
159 states(dict): A dictionary contains state names and
160 corresponding values. The value shoud be either a
161 PyTensor or numpy ndarray
162 """
163 names = states.keys()
164 sublayers = self._layers
165 for name, sublayer in sublayers.items():
166 if sublayer._initialized:
167 if self._has_layer_param(sublayer, names):
168 sublayer.set_states(states)
169 self.set_params(states)
170
171 def dtype_check(self, *inputs):
172 """ check if all input have same data type.

Callers

nothing calls this directly

Calls 2

_has_layer_paramMethod · 0.95
set_paramsMethod · 0.95

Tested by

no test coverage detected