image_to_image.amp.dummy_scaler
1class DummyScaler: 2 """ 3 A dummy AMP scaler that does nothing. 4 5 Can be used as a drop-in replacement for torch.cuda.amp.GradScaler. 6 """ 7 8 def __init__(self): 9 pass 10 11 def scale(self, loss): 12 # Just return the loss unchanged 13 return loss 14 15 def step(self, optimizer): 16 # Do nothing 17 optimizer.step() 18 19 def update(self, new_scale=None): 20 # Do nothing 21 pass 22 23 def unscale_(self, optimizer): 24 # Do nothing 25 pass 26 27 def state_dict(self): 28 # Return empty dict for compatibility 29 return {} 30 31 def load_state_dict(self, state_dict): 32 # Do nothing 33 pass
class
DummyScaler:
3class DummyScaler: 4 """ 5 A dummy AMP scaler that does nothing. 6 7 Can be used as a drop-in replacement for torch.cuda.amp.GradScaler. 8 """ 9 10 def __init__(self): 11 pass 12 13 def scale(self, loss): 14 # Just return the loss unchanged 15 return loss 16 17 def step(self, optimizer): 18 # Do nothing 19 optimizer.step() 20 21 def update(self, new_scale=None): 22 # Do nothing 23 pass 24 25 def unscale_(self, optimizer): 26 # Do nothing 27 pass 28 29 def state_dict(self): 30 # Return empty dict for compatibility 31 return {} 32 33 def load_state_dict(self, state_dict): 34 # Do nothing 35 pass
A dummy AMP scaler that does nothing.
Can be used as a drop-in replacement for torch.cuda.amp.GradScaler.