提交 dd9684fd 编写于 作者: A A. Unique TensorFlower 提交者: TensorFlower Gardener

Kernels and ops for all optimizers when using resource variables.

Only enables for gradient descent so far.
Change: 144331045
上级 e8f2aad0
......@@ -3228,6 +3228,7 @@ tf_kernel_library(
prefix = "training_ops",
deps = [
":bounds_check",
":variable_ops",
"//tensorflow/core:framework",
"//tensorflow/core:lib",
"//tensorflow/core:training_ops_op_lib",
......
此差异已折叠。
......@@ -52,8 +52,10 @@ class GradientDescentOptimizer(optimizer.Optimizer):
use_locking=self._use_locking).op
def _resource_apply_dense(self, grad, handle):
return resource_variable_ops.assign_add_variable_op(
handle, -grad * self._learning_rate)
return training_ops.resource_apply_gradient_descent(
handle, math_ops.cast(self._learning_rate_tensor,
grad.dtype.base_dtype),
grad, use_locking=self._use_locking)
def _resource_apply_sparse(self, grad, handle, indices):
return resource_variable_ops.resource_scatter_add(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册