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

Method check

tensorflow/contrib/graph_editor/reroute.py:81–98  ·  view source on GitHub ↗

Check swap mode. Args: mode: an integer representing one of the modes. Returns: A tuple `(a2b, b2a)` boolean indicating what rerouting needs doing. Raises: ValueError: if mode is outside the enum range.

(cls, mode)

Source from the content-addressed store, hash-verified

79
80 @classmethod
81 def check(cls, mode):
82 """Check swap mode.
83
84 Args:
85 mode: an integer representing one of the modes.
86 Returns:
87 A tuple `(a2b, b2a)` boolean indicating what rerouting needs doing.
88 Raises:
89 ValueError: if mode is outside the enum range.
90 """
91 if mode == cls.swap:
92 return True, True
93 elif mode == cls.b2a:
94 return False, True
95 elif mode == cls.a2b:
96 return True, False
97 else:
98 raise ValueError("Unknown _RerouteMode: {}".format(mode))
99
100
101def _reroute_t(t0, t1, consumers1, can_modify=None, cannot_modify=None):

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected