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

Function _NodeDef

tensorflow/python/framework/ops.py:1532–1558  ·  view source on GitHub ↗

Create a NodeDef proto. Args: op_type: Value for the "op" attribute of the NodeDef proto. name: Value for the "name" attribute of the NodeDef proto. device: string, device, or function from NodeDef to string. Value for the "device" attribute of the NodeDef proto. attrs: Opti

(op_type, name, device=None, attrs=None)

Source from the content-addressed store, hash-verified

1530
1531
1532def _NodeDef(op_type, name, device=None, attrs=None): # pylint: disable=redefined-outer-name
1533 """Create a NodeDef proto.
1534
1535 Args:
1536 op_type: Value for the "op" attribute of the NodeDef proto.
1537 name: Value for the "name" attribute of the NodeDef proto.
1538 device: string, device, or function from NodeDef to string. Value for the
1539 "device" attribute of the NodeDef proto.
1540 attrs: Optional dictionary where the key is the attribute name (a string)
1541 and the value is the respective "attr" attribute of the NodeDef proto (an
1542 AttrValue).
1543
1544 Returns:
1545 A node_def_pb2.NodeDef protocol buffer.
1546 """
1547 node_def = node_def_pb2.NodeDef()
1548 node_def.op = compat.as_bytes(op_type)
1549 node_def.name = compat.as_bytes(name)
1550 if attrs is not None:
1551 for k, v in six.iteritems(attrs):
1552 node_def.attr[k].CopyFrom(v)
1553 if device is not None:
1554 if callable(device):
1555 node_def.device = device(node_def)
1556 else:
1557 node_def.device = _device_string(device)
1558 return node_def
1559
1560
1561# Copied from core/framework/node_def_util.cc

Callers 1

_create_op_internalMethod · 0.85

Calls 3

_device_stringFunction · 0.85
deviceFunction · 0.70
CopyFromMethod · 0.45

Tested by

no test coverage detected