/venv/Lib/site-packages/tensorflow/contrib/boosted_trees/python/ops/gen_model_ops.py

https://github.com/nimeshabuddhika/Tensorflow-Chatbot · Python · 333 lines · 151 code · 18 blank · 164 comment · 14 complexity · 4132cdf355b9aa1037088fcfb3a16210 MD5 · raw file

  1. """Python wrappers around TensorFlow ops.
  2. This file is MACHINE GENERATED! Do not edit.
  3. """
  4. import collections as _collections
  5. from tensorflow.python.eager import execute as _execute
  6. from tensorflow.python.eager import context as _context
  7. from tensorflow.python.eager import core as _core
  8. from tensorflow.python.framework import dtypes as _dtypes
  9. from tensorflow.python.framework import tensor_shape as _tensor_shape
  10. from tensorflow.core.framework import op_def_pb2 as _op_def_pb2
  11. # Needed to trigger the call to _set_call_cpp_shape_fn.
  12. from tensorflow.python.framework import common_shapes as _common_shapes
  13. from tensorflow.python.framework import op_def_registry as _op_def_registry
  14. from tensorflow.python.framework import ops as _ops
  15. from tensorflow.python.framework import op_def_library as _op_def_library
  16. def create_tree_ensemble_variable(tree_ensemble_handle, stamp_token, tree_ensemble_config, name=None):
  17. r"""Creates a tree ensemble model and returns a handle to it.
  18. Args:
  19. tree_ensemble_handle: A `Tensor` of type `resource`.
  20. Handle to the tree ensemble resource to be created.
  21. stamp_token: A `Tensor` of type `int64`.
  22. Token to use as the initial value of the resource stamp.
  23. tree_ensemble_config: A `Tensor` of type `string`.
  24. Serialized proto of the tree ensemble.
  25. name: A name for the operation (optional).
  26. Returns:
  27. The created Operation.
  28. """
  29. _ctx = _context.context()
  30. if _ctx.in_graph_mode():
  31. _, _, _op = _op_def_lib._apply_op_helper(
  32. "CreateTreeEnsembleVariable",
  33. tree_ensemble_handle=tree_ensemble_handle, stamp_token=stamp_token,
  34. tree_ensemble_config=tree_ensemble_config, name=name)
  35. return _op
  36. else:
  37. tree_ensemble_handle = _ops.convert_to_tensor(tree_ensemble_handle, _dtypes.resource)
  38. stamp_token = _ops.convert_to_tensor(stamp_token, _dtypes.int64)
  39. tree_ensemble_config = _ops.convert_to_tensor(tree_ensemble_config, _dtypes.string)
  40. _inputs_flat = [tree_ensemble_handle, stamp_token, tree_ensemble_config]
  41. _attrs = None
  42. _result = _execute.execute(b"CreateTreeEnsembleVariable", 0,
  43. inputs=_inputs_flat, attrs=_attrs, ctx=_ctx,
  44. name=name)
  45. return _result
  46. def decision_tree_ensemble_resource_handle_op(container="", shared_name="", name=None):
  47. r"""Creates a handle to a DecisionTreeEnsembleResource
  48. Args:
  49. container: An optional `string`. Defaults to `""`.
  50. shared_name: An optional `string`. Defaults to `""`.
  51. name: A name for the operation (optional).
  52. Returns:
  53. A `Tensor` of type `resource`.
  54. """
  55. if container is None:
  56. container = ""
  57. container = _execute.make_str(container, "container")
  58. if shared_name is None:
  59. shared_name = ""
  60. shared_name = _execute.make_str(shared_name, "shared_name")
  61. _ctx = _context.context()
  62. if _ctx.in_graph_mode():
  63. _, _, _op = _op_def_lib._apply_op_helper(
  64. "DecisionTreeEnsembleResourceHandleOp", container=container,
  65. shared_name=shared_name, name=name)
  66. _result = _op.outputs[:]
  67. _inputs_flat = _op.inputs
  68. _attrs = ("container", _op.get_attr("container"), "shared_name",
  69. _op.get_attr("shared_name"))
  70. else:
  71. _inputs_flat = []
  72. _attrs = ("container", container, "shared_name", shared_name)
  73. _result = _execute.execute(b"DecisionTreeEnsembleResourceHandleOp", 1,
  74. inputs=_inputs_flat, attrs=_attrs, ctx=_ctx,
  75. name=name)
  76. _execute.record_gradient(
  77. "DecisionTreeEnsembleResourceHandleOp", _inputs_flat, _attrs, _result, name)
  78. _result, = _result
  79. return _result
  80. def tree_ensemble_deserialize(tree_ensemble_handle, stamp_token, tree_ensemble_config, name=None):
  81. r"""Deserializes a serialized tree ensemble config and replaces current tree
  82. ensemble.
  83. Args:
  84. tree_ensemble_handle: A `Tensor` of type `resource`.
  85. Handle to the tree ensemble.
  86. stamp_token: A `Tensor` of type `int64`.
  87. Token to use as the new value of the resource stamp.
  88. tree_ensemble_config: A `Tensor` of type `string`.
  89. Serialized proto of the ensemble.
  90. name: A name for the operation (optional).
  91. Returns:
  92. The created Operation.
  93. """
  94. _ctx = _context.context()
  95. if _ctx.in_graph_mode():
  96. _, _, _op = _op_def_lib._apply_op_helper(
  97. "TreeEnsembleDeserialize", tree_ensemble_handle=tree_ensemble_handle,
  98. stamp_token=stamp_token, tree_ensemble_config=tree_ensemble_config,
  99. name=name)
  100. return _op
  101. else:
  102. tree_ensemble_handle = _ops.convert_to_tensor(tree_ensemble_handle, _dtypes.resource)
  103. stamp_token = _ops.convert_to_tensor(stamp_token, _dtypes.int64)
  104. tree_ensemble_config = _ops.convert_to_tensor(tree_ensemble_config, _dtypes.string)
  105. _inputs_flat = [tree_ensemble_handle, stamp_token, tree_ensemble_config]
  106. _attrs = None
  107. _result = _execute.execute(b"TreeEnsembleDeserialize", 0,
  108. inputs=_inputs_flat, attrs=_attrs, ctx=_ctx,
  109. name=name)
  110. return _result
  111. def tree_ensemble_is_initialized_op(tree_ensemble_handle, name=None):
  112. r"""Checks whether a tree ensemble has been initialized.
  113. Args:
  114. tree_ensemble_handle: A `Tensor` of type `resource`.
  115. name: A name for the operation (optional).
  116. Returns:
  117. A `Tensor` of type `bool`.
  118. """
  119. _ctx = _context.context()
  120. if _ctx.in_graph_mode():
  121. _, _, _op = _op_def_lib._apply_op_helper(
  122. "TreeEnsembleIsInitializedOp",
  123. tree_ensemble_handle=tree_ensemble_handle, name=name)
  124. _result = _op.outputs[:]
  125. _inputs_flat = _op.inputs
  126. _attrs = None
  127. else:
  128. tree_ensemble_handle = _ops.convert_to_tensor(tree_ensemble_handle, _dtypes.resource)
  129. _inputs_flat = [tree_ensemble_handle]
  130. _attrs = None
  131. _result = _execute.execute(b"TreeEnsembleIsInitializedOp", 1,
  132. inputs=_inputs_flat, attrs=_attrs, ctx=_ctx,
  133. name=name)
  134. _execute.record_gradient(
  135. "TreeEnsembleIsInitializedOp", _inputs_flat, _attrs, _result, name)
  136. _result, = _result
  137. return _result
  138. _tree_ensemble_serialize_outputs = ["stamp_token", "tree_ensemble_config"]
  139. _TreeEnsembleSerializeOutput = _collections.namedtuple(
  140. "TreeEnsembleSerialize", _tree_ensemble_serialize_outputs)
  141. def tree_ensemble_serialize(tree_ensemble_handle, name=None):
  142. r"""Serializes the tree ensemble to a proto.
  143. Args:
  144. tree_ensemble_handle: A `Tensor` of type `resource`.
  145. Handle to the tree ensemble.
  146. name: A name for the operation (optional).
  147. Returns:
  148. A tuple of `Tensor` objects (stamp_token, tree_ensemble_config).
  149. stamp_token: A `Tensor` of type `int64`. Stamp token of the tree ensemble resource.
  150. tree_ensemble_config: A `Tensor` of type `string`. Serialized proto of the ensemble.
  151. """
  152. _ctx = _context.context()
  153. if _ctx.in_graph_mode():
  154. _, _, _op = _op_def_lib._apply_op_helper(
  155. "TreeEnsembleSerialize", tree_ensemble_handle=tree_ensemble_handle,
  156. name=name)
  157. _result = _op.outputs[:]
  158. _inputs_flat = _op.inputs
  159. _attrs = None
  160. else:
  161. tree_ensemble_handle = _ops.convert_to_tensor(tree_ensemble_handle, _dtypes.resource)
  162. _inputs_flat = [tree_ensemble_handle]
  163. _attrs = None
  164. _result = _execute.execute(b"TreeEnsembleSerialize", 2,
  165. inputs=_inputs_flat, attrs=_attrs, ctx=_ctx,
  166. name=name)
  167. _execute.record_gradient(
  168. "TreeEnsembleSerialize", _inputs_flat, _attrs, _result, name)
  169. _result = _TreeEnsembleSerializeOutput._make(_result)
  170. return _result
  171. def tree_ensemble_stamp_token(tree_ensemble_handle, name=None):
  172. r"""Retrieves the tree ensemble resource stamp token.
  173. Args:
  174. tree_ensemble_handle: A `Tensor` of type `resource`.
  175. Handle to the tree ensemble.
  176. name: A name for the operation (optional).
  177. Returns:
  178. A `Tensor` of type `int64`. Stamp token of the tree ensemble resource.
  179. """
  180. _ctx = _context.context()
  181. if _ctx.in_graph_mode():
  182. _, _, _op = _op_def_lib._apply_op_helper(
  183. "TreeEnsembleStampToken", tree_ensemble_handle=tree_ensemble_handle,
  184. name=name)
  185. _result = _op.outputs[:]
  186. _inputs_flat = _op.inputs
  187. _attrs = None
  188. else:
  189. tree_ensemble_handle = _ops.convert_to_tensor(tree_ensemble_handle, _dtypes.resource)
  190. _inputs_flat = [tree_ensemble_handle]
  191. _attrs = None
  192. _result = _execute.execute(b"TreeEnsembleStampToken", 1,
  193. inputs=_inputs_flat, attrs=_attrs, ctx=_ctx,
  194. name=name)
  195. _execute.record_gradient(
  196. "TreeEnsembleStampToken", _inputs_flat, _attrs, _result, name)
  197. _result, = _result
  198. return _result
  199. def _InitOpDefLibrary(op_list_proto_bytes):
  200. op_list = _op_def_pb2.OpList()
  201. op_list.ParseFromString(op_list_proto_bytes)
  202. _op_def_registry.register_op_list(op_list)
  203. op_def_lib = _op_def_library.OpDefLibrary()
  204. op_def_lib.add_op_list(op_list)
  205. return op_def_lib
  206. # op {
  207. # name: "CreateTreeEnsembleVariable"
  208. # input_arg {
  209. # name: "tree_ensemble_handle"
  210. # type: DT_RESOURCE
  211. # }
  212. # input_arg {
  213. # name: "stamp_token"
  214. # type: DT_INT64
  215. # }
  216. # input_arg {
  217. # name: "tree_ensemble_config"
  218. # type: DT_STRING
  219. # }
  220. # is_stateful: true
  221. # }
  222. # op {
  223. # name: "DecisionTreeEnsembleResourceHandleOp"
  224. # output_arg {
  225. # name: "resource"
  226. # type: DT_RESOURCE
  227. # }
  228. # attr {
  229. # name: "container"
  230. # type: "string"
  231. # default_value {
  232. # s: ""
  233. # }
  234. # }
  235. # attr {
  236. # name: "shared_name"
  237. # type: "string"
  238. # default_value {
  239. # s: ""
  240. # }
  241. # }
  242. # is_stateful: true
  243. # }
  244. # op {
  245. # name: "TreeEnsembleDeserialize"
  246. # input_arg {
  247. # name: "tree_ensemble_handle"
  248. # type: DT_RESOURCE
  249. # }
  250. # input_arg {
  251. # name: "stamp_token"
  252. # type: DT_INT64
  253. # }
  254. # input_arg {
  255. # name: "tree_ensemble_config"
  256. # type: DT_STRING
  257. # }
  258. # is_stateful: true
  259. # }
  260. # op {
  261. # name: "TreeEnsembleIsInitializedOp"
  262. # input_arg {
  263. # name: "tree_ensemble_handle"
  264. # type: DT_RESOURCE
  265. # }
  266. # output_arg {
  267. # name: "is_initialized"
  268. # type: DT_BOOL
  269. # }
  270. # is_stateful: true
  271. # }
  272. # op {
  273. # name: "TreeEnsembleSerialize"
  274. # input_arg {
  275. # name: "tree_ensemble_handle"
  276. # type: DT_RESOURCE
  277. # }
  278. # output_arg {
  279. # name: "stamp_token"
  280. # type: DT_INT64
  281. # }
  282. # output_arg {
  283. # name: "tree_ensemble_config"
  284. # type: DT_STRING
  285. # }
  286. # is_stateful: true
  287. # }
  288. # op {
  289. # name: "TreeEnsembleStampToken"
  290. # input_arg {
  291. # name: "tree_ensemble_handle"
  292. # type: DT_RESOURCE
  293. # }
  294. # output_arg {
  295. # name: "stamp_token"
  296. # type: DT_INT64
  297. # }
  298. # is_stateful: true
  299. # }
  300. _op_def_lib = _InitOpDefLibrary(b"\nd\n\032CreateTreeEnsembleVariable\022\030\n\024tree_ensemble_handle\030\024\022\017\n\013stamp_token\030\t\022\030\n\024tree_ensemble_config\030\007\210\001\001\nk\n$DecisionTreeEnsembleResourceHandleOp\032\014\n\010resource\030\024\"\027\n\tcontainer\022\006string\032\002\022\000\"\031\n\013shared_name\022\006string\032\002\022\000\210\001\001\na\n\027TreeEnsembleDeserialize\022\030\n\024tree_ensemble_handle\030\024\022\017\n\013stamp_token\030\t\022\030\n\024tree_ensemble_config\030\007\210\001\001\nN\n\033TreeEnsembleIsInitializedOp\022\030\n\024tree_ensemble_handle\030\024\032\022\n\016is_initialized\030\n\210\001\001\n_\n\025TreeEnsembleSerialize\022\030\n\024tree_ensemble_handle\030\024\032\017\n\013stamp_token\030\t\032\030\n\024tree_ensemble_config\030\007\210\001\001\nF\n\026TreeEnsembleStampToken\022\030\n\024tree_ensemble_handle\030\024\032\017\n\013stamp_token\030\t\210\001\001")