MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / autocast

Function autocast

PATH/core/models/ckpt.py:401–407  ·  view source on GitHub ↗

Similar to torch.cuda.amp.autocast, but compatible with torch 1.5.1

(enabled: bool)

Source from the content-addressed store, hash-verified

399
400@contextmanager
401def autocast(enabled: bool) -> Generator:
402 """Similar to torch.cuda.amp.autocast, but compatible with torch 1.5.1"""
403 if enabled:
404 with torch.cuda.amp.autocast(enabled):
405 yield
406 else:
407 yield
408
409
410class CheckpointFunction(torch.autograd.Function):

Callers 1

backwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected