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

Method close

torch/utils/data/datapipes/utils/common.py:335–348  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

333 return getattr(file_obj, name)
334
335 def close(self, *args, **kwargs):
336 if self.closed:
337 return
338 if StreamWrapper.debug_unclosed_streams:
339 del StreamWrapper.session_streams[self]
340 if hasattr(self, "parent_stream") and self.parent_stream is not None:
341 self.parent_stream.child_counter -= 1
342 if not self.parent_stream.child_counter and self.parent_stream.close_on_last_child:
343 self.parent_stream.close()
344 try:
345 self.file_obj.close(*args, **kwargs)
346 except AttributeError:
347 pass
348 self.closed = True
349
350 def autoclose(self):
351 """Automatically close stream when all child streams are closed or if there are none."""

Callers 7

autocloseMethod · 0.95
__del__Method · 0.95
_shutdown_workersMethod · 0.45
_worker_loopFunction · 0.45
decode1Method · 0.45
close_streamsMethod · 0.45
__iter__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected