MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / as_unique

Method as_unique

imperative/python/megengine/utils/network.py:733–743  ·  view source on GitHub ↗

r"""assert that this iterator yields only one node and return it Returns: class:`.GraphNodeBase`: the unique node Raises: ValueError if this iterator does not yield a unique node

(self)

Source from the content-addressed store, hash-verified

731 return list(self)
732
733 def as_unique(self):
734 r"""assert that this iterator yields only one node and return it
735
736 Returns:
737 class:`.GraphNodeBase`: the unique node
738
739 Raises:
740 ValueError if this iterator does not yield a unique node
741 """
742 (opr,) = self
743 return opr
744
745 def as_dict(self):
746 r"""construct an ordered dict to map from node names to objects in

Callers 15

test_replace_varFunction · 0.45
test_replace_oprFunction · 0.45
test_splice_networkFunction · 0.45
test_modify_paramsFunction · 0.45
test_make_constFunction · 0.45
test_add_inputFunction · 0.45
test_add_remove_outputFunction · 0.45
test_queryFunction · 0.45
test_reset_batchsizeFunction · 0.45
test_modify_opr_nameFunction · 0.45
test_searchFunction · 0.45

Calls

no outgoing calls

Tested by 15

test_replace_varFunction · 0.36
test_replace_oprFunction · 0.36
test_splice_networkFunction · 0.36
test_modify_paramsFunction · 0.36
test_make_constFunction · 0.36
test_add_inputFunction · 0.36
test_add_remove_outputFunction · 0.36
test_queryFunction · 0.36
test_reset_batchsizeFunction · 0.36
test_modify_opr_nameFunction · 0.36
test_searchFunction · 0.36