• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# =============================================================================
2# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# =============================================================================
16
17from __future__ import absolute_import
18from __future__ import division
19from __future__ import print_function
20
21# pylint: disable=unused-import
22from tensorflow.contrib.periodic_resample.python.ops import gen_periodic_resample_op
23
24from tensorflow.contrib.periodic_resample.python.ops.gen_periodic_resample_op import periodic_resample, periodic_resample_op_grad
25
26from tensorflow.contrib.util import loader
27from tensorflow.python.framework import ops
28from tensorflow.python.platform import resource_loader
29# pylint: enable=unused-import
30
31_periodic_resample_op = loader.load_op_library(
32    resource_loader.get_path_to_datafile('_periodic_resample_op.so'))
33
34@ops.RegisterGradient("PeriodicResample")
35def _periodic_resample_grad_cc(op, grad):
36  return periodic_resample_op_grad(
37      grad, op.inputs[0].shape, op.get_attr('shape'))
38