提交 75d8bd3a 编写于 作者: Z Zhenyu Tan 提交者: TensorFlower Gardener

Internal change

PiperOrigin-RevId: 237047796
上级 8b767812
......@@ -526,11 +526,13 @@ class OptimizerV2(trackable.Trackable):
initializer, shape=var.shape, dtype=var.dtype)
else:
initial_value = initializer
weight = tf_variables.Variable(
name="%s/%s" % (var._shared_name, slot_name), # pylint: disable=protected-access
dtype=var.dtype,
trainable=False,
initial_value=initial_value)
strategy = distribute_ctx.get_strategy()
with strategy.colocate_vars_with(var):
weight = tf_variables.Variable(
name="%s/%s" % (var._shared_name, slot_name), # pylint: disable=protected-access
dtype=var.dtype,
trainable=False,
initial_value=initial_value)
backend.track_variable(weight)
slot_dict[slot_name] = weight
self._restore_slot_variable(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册