otx.algorithms.common.adapters.torch.amp.xpu_grad_scaler#

Custom GradScaler to scale loss.

Classes

XPUGradScaler([init_scale, growth_factor, ...])

GradScaler for XPU.

class otx.algorithms.common.adapters.torch.amp.xpu_grad_scaler.XPUGradScaler(init_scale=65536.0, growth_factor=2.0, backoff_factor=0.5, growth_interval=2000, enabled=True)[source]#

Bases: GradScaler

GradScaler for XPU.

scale(outputs)[source]#

Multiplies (‘scales’) a tensor or list of tensors by the scale factor.

Returns scaled outputs. If this instance of GradScaler is not enabled, outputs are returned unmodified.

Parameters:

outputs (Tensor or iterable of Tensors) – Outputs to scale.