(
self,
op_type,
inputs,
dtypes, # pylint: disable=redefined-outer-name
input_types=None,
name=None,
attrs=None,
op_def=None,
compute_device=True)
| 444 | self._weak_variables = [weakref.ref(v) for v in var_list] |
| 445 | |
| 446 | def _capture_by_value( |
| 447 | self, |
| 448 | op_type, |
| 449 | inputs, |
| 450 | dtypes, # pylint: disable=redefined-outer-name |
| 451 | input_types=None, |
| 452 | name=None, |
| 453 | attrs=None, |
| 454 | op_def=None, |
| 455 | compute_device=True): |
| 456 | # When capturing by value, do the read outside |
| 457 | reverse_captures = dict((id(v), k) for k, v in self.captures) |
| 458 | uncaptured_inputs = [reverse_captures.get(id(t), t) for t in inputs] |
| 459 | with ops.init_scope(): |
| 460 | if context.executing_eagerly(): |
| 461 | attr_list = ("dtype", int(attrs["dtype"].type)) |
| 462 | value, = execute.execute( |
| 463 | compat.as_bytes(op_type), 1, uncaptured_inputs, attr_list, |
| 464 | context.context()) |
| 465 | else: |
| 466 | op = ops.get_default_graph()._create_op_internal( # pylint: disable=protected-access |
| 467 | op_type, |
| 468 | uncaptured_inputs, |
| 469 | dtypes, |
| 470 | input_types, |
| 471 | name, |
| 472 | attrs, |
| 473 | op_def, |
| 474 | compute_device) |
| 475 | value = op.outputs[0] |
| 476 | captured_value = self.capture(value) |
| 477 | return captured_value.op |
| 478 | |
| 479 | def create_op( |
| 480 | self, |
no test coverage detected