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

Method iterate_inbound

tensorflow/python/keras/engine/node.py:134–166  ·  view source on GitHub ↗

Returns a list of tuples representing the inbound data. Arguments: include_arguments: Whether to also iterate over any Keras Tensors passed as args, kwargs. Returns: List of tuples like: (inbound_layer, node_index, tensor_index, tensor).

(self, include_arguments=False)

Source from the content-addressed store, hash-verified

132 outbound_layer.inbound_nodes.append(self)
133
134 def iterate_inbound(self, include_arguments=False):
135 """Returns a list of tuples representing the inbound data.
136
137 Arguments:
138 include_arguments: Whether to also iterate over any Keras Tensors
139 passed as args, kwargs.
140
141 Returns:
142 List of tuples like: (inbound_layer, node_index, tensor_index, tensor).
143 """
144 inputs_inbound = list(
145 zip(
146 nest.flatten(self.inbound_layers),
147 nest.flatten(self.node_indices),
148 nest.flatten(self.tensor_indices),
149 nest.flatten(self.input_tensors)))
150
151 if include_arguments:
152 keras_tensor_arguments = [
153 kt for kt in nest.flatten(self.arguments)
154 if hasattr(kt, '_keras_history')
155 ]
156
157 def _get_inbound(keras_tensor):
158 kh = keras_tensor._keras_history
159 return kh.layer, kh.node_index, kh.tensor_index, keras_tensor
160
161 arguments_inbound = nest.map_structure(_get_inbound,
162 keras_tensor_arguments)
163
164 return inputs_inbound + arguments_inbound
165 else:
166 return inputs_inbound
167
168 def _get_all_node_dependencies(self):
169 """Returns all of the nodes this node immediately depends on."""

Callers 7

get_source_inputsFunction · 0.80
compute_output_shapeMethod · 0.80
get_configMethod · 0.80
_get_min_depthMethod · 0.80
build_mapFunction · 0.80

Calls 1

flattenMethod · 0.45

Tested by

no test coverage detected