Utility to create an op.
(op_type, inputs, op_dtypes, attrs=None)
| 899 | |
| 900 | # TODO(agarwal): call raw_ops instead of calling these low level routines. |
| 901 | def _create_op(op_type, inputs, op_dtypes, attrs=None): |
| 902 | """Utility to create an op.""" |
| 903 | op = ops.get_default_graph().create_op( |
| 904 | op_type, inputs, op_dtypes, attrs=attrs, compute_device=True) |
| 905 | flat_attrs = nest.flatten([(str(a), op.get_attr(str(a))) for a in attrs]) |
| 906 | execute.record_gradient( |
| 907 | op_type, op.inputs, tuple(flat_attrs), op.outputs[:], "") |
| 908 | return op |
| 909 | |
| 910 | |
| 911 | WrappedTensor = collections.namedtuple("WrappedTensor", |
no test coverage detected