MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _get_op_def

Method _get_op_def

tensorflow/python/framework/ops.py:3823–3838  ·  view source on GitHub ↗

Returns the `OpDef` proto for `type`. `type` is a string.

(self, type)

Source from the content-addressed store, hash-verified

3821 return self._next_id_counter
3822
3823 def _get_op_def(self, type): # pylint: disable=redefined-builtin
3824 """Returns the `OpDef` proto for `type`. `type` is a string."""
3825 # NOTE: No locking is required because the lookup and insertion operations
3826 # on Python dictionaries are atomic.
3827 try:
3828 return self._op_def_cache[type]
3829 except KeyError:
3830 with c_api_util.tf_buffer() as buf:
3831 # pylint: disable=protected-access
3832 c_api.TF_GraphGetOpDef(self._c_graph, compat.as_bytes(type), buf)
3833 # pylint: enable=protected-access
3834 data = c_api.TF_GetBuffer(buf)
3835 op_def = op_def_pb2.OpDef()
3836 op_def.ParseFromString(compat.as_bytes(data))
3837 self._op_def_cache[type] = op_def
3838 return op_def
3839
3840 def as_default(self):
3841 """Returns a context manager that makes this `Graph` the default graph.

Callers 4

__init__Method · 0.80
op_defMethod · 0.80
_add_op_and_parentsMethod · 0.80

Calls 1

ParseFromStringMethod · 0.45

Tested by

no test coverage detected