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

Method set_weights

tensorflow/python/keras/optimizer_v2/adam.py:177–185  ·  view source on GitHub ↗
(self, weights)

Source from the content-addressed store, hash-verified

175 ))
176
177 def set_weights(self, weights):
178 params = self.weights
179 # If the weights are generated by Keras V1 optimizer, it includes vhats
180 # even without amsgrad, i.e, V1 optimizer has 3x + 1 variables, while V2
181 # optimizer has 2x + 1 variables. Filter vhats out for compatibility.
182 num_vars = int((len(params) - 1) / 2)
183 if len(weights) == 3 * num_vars + 1:
184 weights = weights[:len(params)]
185 super(Adam, self).set_weights(weights)
186
187 def _resource_apply_dense(self, grad, var, apply_state=None):
188 var_device, var_dtype = var.device, var.dtype.base_dtype

Callers 15

test_weight_loadingMethod · 0.45
load_model_from_hdf5Function · 0.45
get_modelMethod · 0.45
__init__Method · 0.45
get_modelMethod · 0.45
get_modelMethod · 0.45
get_modelMethod · 0.45

Calls

no outgoing calls