18
18
from __future__ import division
19
19
from __future__ import print_function
20
20
21
- from tensorflow .contrib .correlation_cost .ops import gen_correlation_cost_op
22
- from tensorflow .contrib .util import loader
21
+ import tensorflow as tf
23
22
from tensorflow .python .framework import ops
24
23
from tensorflow .python .ops import array_ops
25
- from tensorflow . python . platform import resource_loader
24
+ from tensorflow_addons . utils . resource_loader import get_path_to_datafile
26
25
27
- _correlation_cost_op_so = loader .load_op_library (
28
- resource_loader . get_path_to_datafile ("_correlation_cost_op .so" ))
26
+ _correlation_cost_op_so = tf .load_op_library (
27
+ get_path_to_datafile ("custom_ops/opticalflow/_correlation_cost_ops .so" ))
29
28
30
29
# pylint: disable=redefined-builtin
31
30
@@ -81,7 +80,7 @@ def correlation_cost(input_a,
81
80
"""
82
81
83
82
with ops .name_scope (name , "correlation_cost" ):
84
- op_call = gen_correlation_cost_op .correlation_cost
83
+ op_call = _correlation_cost_op_so .correlation_cost
85
84
ret = op_call (
86
85
input_a ,
87
86
input_b ,
@@ -98,7 +97,7 @@ def correlation_cost(input_a,
98
97
return ret
99
98
100
99
101
- correlation_cost_grad = gen_correlation_cost_op .correlation_cost_grad
100
+ correlation_cost_grad = _correlation_cost_op_so .correlation_cost_grad
102
101
103
102
104
103
@ops .RegisterGradient ("CorrelationCost" )
@@ -114,7 +113,7 @@ def _correlation_cost_grad(op, grad_output):
114
113
input_b = ops .convert_to_tensor (op .inputs [1 ], name = "input_b" )
115
114
grad_output_tensor = ops .convert_to_tensor (grad_output , name = "grad_output" )
116
115
117
- op_call = gen_correlation_cost_op .correlation_cost_grad
116
+ op_call = _correlation_cost_op_so .correlation_cost_grad
118
117
grads = op_call (
119
118
input_a ,
120
119
input_b ,
0 commit comments