grl_ops.py 1.1 KB

1234567891011121314151617181920212223242526272829
  1. # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ==============================================================================
  15. """GradientReversal op Python library."""
  16. from __future__ import absolute_import
  17. from __future__ import division
  18. from __future__ import print_function
  19. import os.path
  20. import tensorflow as tf
  21. tf.logging.info(tf.resource_loader.get_data_files_path())
  22. _grl_ops_module = tf.load_op_library(
  23. os.path.join(tf.resource_loader.get_data_files_path(),
  24. '_grl_ops.so'))
  25. gradient_reversal = _grl_ops_module.gradient_reversal