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

Method flatten_nodes

tensorflow/lite/python/op_hint.py:557–575  ·  view source on GitHub ↗

Return a list of all the node protos in aggregation sorted order.

(self)

Source from the content-addressed store, hash-verified

555 self.nodes[sort] = node
556
557 def flatten_nodes(self):
558 """Return a list of all the node protos in aggregation sorted order."""
559 if not self.flattened:
560 self.flattened = [None] * len(self.nodes)
561 for idx, node in _six.iteritems(self.nodes):
562 self.flattened[idx] = node
563 for n in self.nodes:
564 if n is None:
565 raise RuntimeError("Aggregate was missing argument.")
566 if self.aggregation == OpHint.AGGREGATE_FIRST:
567 self.flattened = self.flattened[:1]
568 elif self.aggregation == OpHint.AGGREGATE_LAST:
569 self.flattened = self.flattened[-1:]
570 elif self.aggregation == OpHint.AGGREGATE_STACK:
571 pass
572 else:
573 raise ValueError(
574 "Invalid aggregation type %r specified" % self.aggregation)
575 return self.flattened
576
577 def flatten(self):
578 """Return a list of all node names in aggregation sorted sorter."""

Calls

no outgoing calls

Tested by

no test coverage detected