/Tensorflow_Pandas_Numpy/source3.6/tensorflow/contrib/resampler/ops/gen_resampler_ops.py

https://github.com/ryfeus/lambda-packs · Python · 167 lines · 65 code · 12 blank · 90 comment · 4 complexity · 986dafc068b6b8d872f527b9e2059aab MD5 · raw file

  1. """Python wrappers around TensorFlow ops.
  2. This file is MACHINE GENERATED! Do not edit.
  3. Original C++ source file: resampler_ops.cc
  4. """
  5. import collections as _collections
  6. from tensorflow.python.eager import execute as _execute
  7. from tensorflow.python.eager import context as _context
  8. from tensorflow.python.eager import core as _core
  9. from tensorflow.python.framework import dtypes as _dtypes
  10. from tensorflow.python.framework import tensor_shape as _tensor_shape
  11. from tensorflow.core.framework import op_def_pb2 as _op_def_pb2
  12. # Needed to trigger the call to _set_call_cpp_shape_fn.
  13. from tensorflow.python.framework import common_shapes as _common_shapes
  14. from tensorflow.python.framework import op_def_registry as _op_def_registry
  15. from tensorflow.python.framework import ops as _ops
  16. from tensorflow.python.framework import op_def_library as _op_def_library
  17. def resampler(data, warp, name=None):
  18. r"""Resampler op.
  19. Args:
  20. data: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`.
  21. warp: A `Tensor`. Must have the same type as `data`.
  22. name: A name for the operation (optional).
  23. Returns:
  24. A `Tensor`. Has the same type as `data`.
  25. """
  26. _ctx = _context.context()
  27. if _ctx.in_graph_mode():
  28. _, _, _op = _op_def_lib._apply_op_helper(
  29. "Resampler", data=data, warp=warp, name=name)
  30. _result = _op.outputs[:]
  31. _inputs_flat = _op.inputs
  32. _attrs = ("T", _op.get_attr("T"))
  33. else:
  34. _attr_T, _inputs_T = _execute.args_to_matching_eager([data, warp], _ctx)
  35. (data, warp) = _inputs_T
  36. _attr_T = _attr_T.as_datatype_enum
  37. _inputs_flat = [data, warp]
  38. _attrs = ("T", _attr_T)
  39. _result = _execute.execute(b"Resampler", 1, inputs=_inputs_flat,
  40. attrs=_attrs, ctx=_ctx, name=name)
  41. _execute.record_gradient(
  42. "Resampler", _inputs_flat, _attrs, _result, name)
  43. _result, = _result
  44. return _result
  45. _ops.RegisterShape("Resampler")(None)
  46. _resampler_grad_outputs = ["grad_data", "grad_warp"]
  47. _ResamplerGradOutput = _collections.namedtuple(
  48. "ResamplerGrad", _resampler_grad_outputs)
  49. def resampler_grad(data, warp, grad_output, name=None):
  50. r"""Resampler Grad op.
  51. Args:
  52. data: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`.
  53. warp: A `Tensor`. Must have the same type as `data`.
  54. grad_output: A `Tensor`. Must have the same type as `data`.
  55. name: A name for the operation (optional).
  56. Returns:
  57. A tuple of `Tensor` objects (grad_data, grad_warp).
  58. grad_data: A `Tensor`. Has the same type as `data`.
  59. grad_warp: A `Tensor`. Has the same type as `data`.
  60. """
  61. _ctx = _context.context()
  62. if _ctx.in_graph_mode():
  63. _, _, _op = _op_def_lib._apply_op_helper(
  64. "ResamplerGrad", data=data, warp=warp, grad_output=grad_output,
  65. name=name)
  66. _result = _op.outputs[:]
  67. _inputs_flat = _op.inputs
  68. _attrs = ("T", _op.get_attr("T"))
  69. else:
  70. _attr_T, _inputs_T = _execute.args_to_matching_eager([data, warp, grad_output], _ctx)
  71. (data, warp, grad_output) = _inputs_T
  72. _attr_T = _attr_T.as_datatype_enum
  73. _inputs_flat = [data, warp, grad_output]
  74. _attrs = ("T", _attr_T)
  75. _result = _execute.execute(b"ResamplerGrad", 2, inputs=_inputs_flat,
  76. attrs=_attrs, ctx=_ctx, name=name)
  77. _execute.record_gradient(
  78. "ResamplerGrad", _inputs_flat, _attrs, _result, name)
  79. _result = _ResamplerGradOutput._make(_result)
  80. return _result
  81. _ops.RegisterShape("ResamplerGrad")(None)
  82. def _InitOpDefLibrary(op_list_proto_bytes):
  83. op_list = _op_def_pb2.OpList()
  84. op_list.ParseFromString(op_list_proto_bytes)
  85. _op_def_registry.register_op_list(op_list)
  86. op_def_lib = _op_def_library.OpDefLibrary()
  87. op_def_lib.add_op_list(op_list)
  88. return op_def_lib
  89. # op {
  90. # name: "Resampler"
  91. # input_arg {
  92. # name: "data"
  93. # type_attr: "T"
  94. # }
  95. # input_arg {
  96. # name: "warp"
  97. # type_attr: "T"
  98. # }
  99. # output_arg {
  100. # name: "output"
  101. # type_attr: "T"
  102. # }
  103. # attr {
  104. # name: "T"
  105. # type: "type"
  106. # allowed_values {
  107. # list {
  108. # type: DT_HALF
  109. # type: DT_FLOAT
  110. # type: DT_DOUBLE
  111. # }
  112. # }
  113. # }
  114. # }
  115. # op {
  116. # name: "ResamplerGrad"
  117. # input_arg {
  118. # name: "data"
  119. # type_attr: "T"
  120. # }
  121. # input_arg {
  122. # name: "warp"
  123. # type_attr: "T"
  124. # }
  125. # input_arg {
  126. # name: "grad_output"
  127. # type_attr: "T"
  128. # }
  129. # output_arg {
  130. # name: "grad_data"
  131. # type_attr: "T"
  132. # }
  133. # output_arg {
  134. # name: "grad_warp"
  135. # type_attr: "T"
  136. # }
  137. # attr {
  138. # name: "T"
  139. # type: "type"
  140. # allowed_values {
  141. # list {
  142. # type: DT_HALF
  143. # type: DT_FLOAT
  144. # type: DT_DOUBLE
  145. # }
  146. # }
  147. # }
  148. # }
  149. _op_def_lib = _InitOpDefLibrary(b"\nB\n\tResampler\022\t\n\004data\"\001T\022\t\n\004warp\"\001T\032\013\n\006output\"\001T\"\022\n\001T\022\004type:\007\n\0052\003\023\001\002\nk\n\rResamplerGrad\022\t\n\004data\"\001T\022\t\n\004warp\"\001T\022\020\n\013grad_output\"\001T\032\016\n\tgrad_data\"\001T\032\016\n\tgrad_warp\"\001T\"\022\n\001T\022\004type:\007\n\0052\003\023\001\002")