MCPcopy Create free account
hub / github.com/pytorch/pytorch / stop_if

Method stop_if

caffe2/python/net_builder.py:262–273  ·  view source on GitHub ↗

Stop execution of the current execution step if the condition `blob` is met. Example: ops.Print(a, 0) ops.stop_if(ops.LE([x, ops.Const(0)])) ops.Print(b, 0) In the example, 'b' will only be printed if the value

(self, blob)

Source from the content-addressed store, hash-verified

260 return self.stop_if(ops.Const(True))
261
262 def stop_if(self, blob):
263 """
264 Stop execution of the current execution step if the
265 condition `blob` is met.
266 Example:
267 ops.Print(a, 0)
268 ops.stop_if(ops.LE([x, ops.Const(0)]))
269 ops.Print(b, 0)
270 In the example, 'b' will only be printed if the value of scalar
271 tensor 'x' is greater than 0.
272 """
273 return NetBuilder.current().stop_if(blob)
274
275 def loop(self, iters=None, name=None):
276 """

Callers 1

stopMethod · 0.95

Calls 2

currentMethod · 0.80
stop_ifMethod · 0.45

Tested by

no test coverage detected