Skip to content

weight decay optimizers doesn't support tf.half on gpu in eager mode #347

@facaiy

Description

@facaiy

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): tf-nightly-gpu-2.0-preview
  • TensorFlow Addons installed from (source, PyPi): source
  • TensorFlow Addons version: master
  • Python version and type (eg. Anaconda Python, Stock Python as in Mac, or homebrew installed Python etc): tensorflow/tensorflow:custom-op-gpu
  • Bazel version (if compiling from source): N/A
  • GCC/Compiler version (if compiling from source):
  • Is GPU used? (yes/no): yes
  • GPU model (if used):

Describe the bug

Because tf doesn't register tf.half GPU kernel for ResourceScatterAdd op,
https://github.com/tensorflow/tensorflow/blob/b9d106e7ccd9003f39192a77c326fb4ac3e973dd/tensorflow/core/kernels/resource_variable_ops.cc#L968

all of the testSparseRepeatedIndices with tf.half failed in:
https://github.com/tensorflow/addons/blob/master/tensorflow_addons/optimizers/weight_decay_optimizers_test.py

I find keras still uses test_util.run_deprecated_v1 for Adam test case
https://github.com/tensorflow/tensorflow/blob/560d21b68805ed3247f897b9ac2e1f203a168f8d/tensorflow/python/keras/optimizer_v2/adam_test.py#L113 , so I guess _resource_scatter_add still cannot work well with tf.half on gpu in eager mode.

Describe the expected behavior

Code to reproduce the issue

Other info / logs

https://source.cloud.google.com/results/invocations/dc386dab-6aeb-4fed-bf01-cc4b8e65c43e/targets/tensorflow_addons%2Fubuntu%2Fgpu%2Fpy2%2Fpresubmit/log

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions