Update the input to this operation at the given index. NOTE: This is for TF internal use only. Please don't use it. Args: index: the index of the input to update. tensor: the Tensor to be used as the input at the given index. Raises: TypeError: if tensor is not a Ten
(self, index, tensor)
| 2022 | device_str) |
| 2023 | |
| 2024 | def _update_input(self, index, tensor): |
| 2025 | """Update the input to this operation at the given index. |
| 2026 | |
| 2027 | NOTE: This is for TF internal use only. Please don't use it. |
| 2028 | |
| 2029 | Args: |
| 2030 | index: the index of the input to update. |
| 2031 | tensor: the Tensor to be used as the input at the given index. |
| 2032 | |
| 2033 | Raises: |
| 2034 | TypeError: if tensor is not a Tensor, |
| 2035 | or if input tensor type is not convertible to dtype. |
| 2036 | ValueError: if the Tensor is from a different graph. |
| 2037 | """ |
| 2038 | if not isinstance(tensor, Tensor): |
| 2039 | raise TypeError("tensor must be a Tensor: %s" % tensor) |
| 2040 | _assert_same_graph(self, tensor) |
| 2041 | |
| 2042 | # Reset cached inputs. |
| 2043 | self._inputs_val = None |
| 2044 | c_api.UpdateEdge( |
| 2045 | self._graph._c_graph, # pylint: disable=protected-access |
| 2046 | tensor._as_tf_output(), # pylint: disable=protected-access |
| 2047 | self._tf_input(index)) |
| 2048 | |
| 2049 | def _add_while_inputs(self, tensors): |
| 2050 | """See AddWhileInputHack in python_api.h. |