Rate this Page

CastConfig#

class torchao.float8.CastConfig(scaling_type: ScalingType = ScalingType.DYNAMIC, scaling_granularity: ScalingGranularity = ScalingGranularity.TENSORWISE, target_dtype: Optional[dtype] = None)[source][source]#

Configuration for casting a single tensor to float8.

Parameters
  • scaling_type – The type of scaling to use. See ScalingType. Default: ScalingType.DYNAMIC

  • scaling_granularity – The granularity of scaling. See ScalingGranularity. Default: ScalingGranularity.TENSORWISE

  • target_dtype – The target float8 dtype (e.g., torch.float8_e4m3fn). Default: None (will be set based on the recipe)