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

Function graph_placeholder

tensorflow/python/eager/graph_only_ops.py:41–53  ·  view source on GitHub ↗

Graph-only version of tf.compat.v1.placeholder(), for internal use only.

(dtype, shape, name=None)

Source from the content-addressed store, hash-verified

39
40
41def graph_placeholder(dtype, shape, name=None):
42 """Graph-only version of tf.compat.v1.placeholder(), for internal use only."""
43 dtype = dtype.base_dtype
44 dtype_value = attr_value_pb2.AttrValue(type=dtype.as_datatype_enum)
45 if isinstance(shape, (list, tuple)):
46 shape = tensor_shape.TensorShape(shape)
47 shape = attr_value_pb2.AttrValue(shape=shape.as_proto())
48 g = ops.get_default_graph()
49 with ops.name_scope(name, "placeholder", []) as name:
50 op = g.create_op("Placeholder", [], [dtype], input_types=[],
51 attrs={"dtype": dtype_value, "shape": shape}, name=name)
52 result, = op.outputs
53 return result

Callers 3

_get_defun_inputsFunction · 0.90

Calls 3

as_protoMethod · 0.80
name_scopeMethod · 0.45
create_opMethod · 0.45

Tested by

no test coverage detected