MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / ExceptionHandler

Class ExceptionHandler

tensorpack/dataflow/image.py:29–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28
29class ExceptionHandler:
30 def __init__(self, catch_exceptions=False):
31 self._nr_error = 0
32 self.catch_exceptions = catch_exceptions
33
34 @contextmanager
35 def catch(self):
36 try:
37 yield
38 except Exception:
39 self._nr_error += 1
40 if not self.catch_exceptions:
41 raise
42 else:
43 if self._nr_error % 100 == 0 or self._nr_error < 10:
44 logger.exception("Got {} augmentation errors.".format(self._nr_error))
45
46
47class ImageFromFile(RNGDataFlow):

Callers 3

__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected