Internal method to create an inbound node for the layer. Arguments: input_tensors: list of input tensors. output_tensors: list of output tensors. arguments: dictionary of keyword arguments that were passed to the `call` method of the layer at the call that cr
(self,
input_tensors,
output_tensors,
arguments=None)
| 2061 | return inputs, outputs |
| 2062 | |
| 2063 | def _add_inbound_node(self, |
| 2064 | input_tensors, |
| 2065 | output_tensors, |
| 2066 | arguments=None): |
| 2067 | """Internal method to create an inbound node for the layer. |
| 2068 | |
| 2069 | Arguments: |
| 2070 | input_tensors: list of input tensors. |
| 2071 | output_tensors: list of output tensors. |
| 2072 | arguments: dictionary of keyword arguments that were passed to the |
| 2073 | `call` method of the layer at the call that created the node. |
| 2074 | """ |
| 2075 | inbound_layers = nest.map_structure(lambda t: t._keras_history.layer, |
| 2076 | input_tensors) |
| 2077 | node_indices = nest.map_structure(lambda t: t._keras_history.node_index, |
| 2078 | input_tensors) |
| 2079 | tensor_indices = nest.map_structure(lambda t: t._keras_history.tensor_index, |
| 2080 | input_tensors) |
| 2081 | |
| 2082 | # Create node, add it to inbound nodes. |
| 2083 | node_module.Node( |
| 2084 | self, |
| 2085 | inbound_layers=inbound_layers, |
| 2086 | node_indices=node_indices, |
| 2087 | tensor_indices=tensor_indices, |
| 2088 | input_tensors=input_tensors, |
| 2089 | output_tensors=output_tensors, |
| 2090 | arguments=arguments) |
| 2091 | |
| 2092 | # Update tensor history metadata. |
| 2093 | # The metadata attribute consists of |
| 2094 | # 1) a layer instance |
| 2095 | # 2) a node index for the layer |
| 2096 | # 3) a tensor index for the node. |
| 2097 | # The allows layer reuse (multiple nodes per layer) and multi-output |
| 2098 | # or multi-input layers (e.g. a layer can return multiple tensors, |
| 2099 | # and each can be sent to a different layer). |
| 2100 | for i, tensor in enumerate(nest.flatten(output_tensors)): |
| 2101 | tensor._keras_history = KerasHistory(self, |
| 2102 | len(self._inbound_nodes) - 1, i) # pylint: disable=protected-access |
| 2103 | |
| 2104 | def _get_node_attribute_at_index(self, node_index, attr, attr_name): |
| 2105 | """Private utility to retrieves an attribute (e.g. inputs) from a node. |
no test coverage detected