chop.nn.quantized.modules#
chop.nn.quantized.modules.attention#
chop.nn.quantized.modules.attention_head#
- class chop.nn.quantized.modules.attention_head.BertSelfAttentionHeadInteger(config, q_config: dict = None)[source]#
Bases:
_BertSelfAttentionHeadBase
- __init__(config, q_config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(query_layer: Tensor, key_layer: Tensor, value_layer: Tensor, attention_mask: FloatTensor | None = None) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
chop.nn.quantized.modules.batch_norm1d#
chop.nn.quantized.modules.batch_norm2d#
- class chop.nn.quantized.modules.batch_norm2d.BatchNorm2dInteger(num_features: int, eps: float = 1e-05, momentum: float = 0.1, affine: bool = True, track_running_stats: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_BatchNorm2dBase
chop.nn.quantized.modules.conv1d#
- class chop.nn.quantized.modules.conv1d.Conv1dInteger(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Bases:
_Conv1dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv1d.Conv1dMinifloatDenorm(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv1dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv1d.Conv1dLog(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv1dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv1d.Conv1dMinifloatIEEE(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv1dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv1d.Conv1dBlockFP(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv1dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv1d.Conv1dBlockMinifloat(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv1dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv1d.Conv1dBlockLog(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: int | Tuple[int] | str = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv1dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: int | Tuple[int] | str = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv1d.Conv1dBinary(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Bases:
_Conv1dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: str | int | Tuple[int] = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv1d.Conv1dTernary(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: int | Tuple[int] | str = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Bases:
_Conv1dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int], stride: int | Tuple[int] = 1, padding: int | Tuple[int] | str = 0, dilation: int | Tuple[int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
chop.nn.quantized.modules.conv2d#
- class chop.nn.quantized.modules.conv2d.Conv2dInteger(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Bases:
_Conv2dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv2d.Conv2dMinifloatDenorm(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv2dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv2d.Conv2dMinifloatIEEE(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv2dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv2d.Conv2dLog(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv2dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv2d.Conv2dBlockFP(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv2dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.conv2d.Conv2dBlockMinifloat(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv2dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.conv2d.Conv2dBlockLog(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: int | Tuple[int, int] | str = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None)[source]#
Bases:
_Conv2dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: int | Tuple[int, int] | str = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config: dict = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.conv2d.Conv2dBinary(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Bases:
_Conv2dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv2d.Conv2dBinaryScaling(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Bases:
_Conv2dBase
Binary scaling variant of the conv2d transformation layer.
“bypass”: Bypass quantization for standard linear transformation.
“data_in_stochastic”, “bias_stochastic”, “weight_stochastic”: Stochastic settings.
“data_in_bipolar”, “bias_bipolar”, “weight_bipolar”: Bipolar settings.
“binary_training”: Apply binary scaling during training.
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.conv2d.Conv2dBinaryResidualSign(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Bases:
_Conv2dBase
Binary conv2d layer with redisual sign variant of the linear transformation layer.
“bypass”: Bypass quantization for standard linear transformation.
“data_in_stochastic”, “bias_stochastic”, “weight_stochastic”: Stochastic settings.
“data_in_bipolar”, “bias_bipolar”, “weight_bipolar”: Bipolar settings.
“binary_training”: Apply binary scaling during training.
“data_in_levels”: The num of residual layers to use.
“data_in_residual_sign” : Apply residual sign on input
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.conv2d.Conv2dTernary(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Bases:
_Conv2dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.conv2d.Conv2dLUT(config: None, in_channels: int, out_channels: int, kernel_size: int | tuple, stride: int | tuple = 1, padding: int | tuple = 0, dilation: int | tuple = 1, groups: int | tuple = 1, bias: bool = True, padding_mode: str = 'zeros', trainer_type: ~typing.Type[~chop.nn.quantizers.LUTNet.BaseTrainer.BaseTrainer] = <class 'chop.nn.quantizers.LUTNet.BaseTrainer.LagrangeTrainer'>, mask_builder_type: ~typing.Type[~chop.nn.quantizers.LUTNet.MaskBase.MaskBase] = <class 'chop.nn.quantizers.LUTNet.MaskBase.MaskExpanded'>, device: str = None)[source]#
Bases:
Module
- mask_builder: MaskBase#
- __init__(config: None, in_channels: int, out_channels: int, kernel_size: int | tuple, stride: int | tuple = 1, padding: int | tuple = 0, dilation: int | tuple = 1, groups: int | tuple = 1, bias: bool = True, padding_mode: str = 'zeros', trainer_type: ~typing.Type[~chop.nn.quantizers.LUTNet.BaseTrainer.BaseTrainer] = <class 'chop.nn.quantizers.LUTNet.BaseTrainer.LagrangeTrainer'>, mask_builder_type: ~typing.Type[~chop.nn.quantizers.LUTNet.MaskBase.MaskBase] = <class 'chop.nn.quantizers.LUTNet.MaskBase.MaskExpanded'>, device: str = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- in_channels: int#
- out_channels: int#
- kernel_size: tuple#
- stride: tuple#
- padding: bool#
- dilation: tuple#
- mask_builder_type: Type[MaskBase]#
- groups: tuple#
- bias: Tensor#
- padding_mode: str#
- k: int#
- input_dim: tuple#
- device: str | None#
- input_mask: Tensor#
- tables_count: int#
- trainer: BaseTrainer#
- forward(input: Tensor, targets: tensor = None, initalize: bool = False)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.conv2d.Conv2DLogicNets(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None)[source]#
Bases:
_Conv2dBase
- __init__(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] = 1, padding: str | int | Tuple[int, int] = 0, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- table_lookup(connected_input: Tensor, input_perm_matrix: Tensor, bin_output_states: Tensor) Tensor [source]#
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
chop.nn.quantized.modules.gelu#
- class chop.nn.quantized.modules.gelu.GELUInteger(inplace: bool = False, config: dict = None)[source]#
Bases:
_GELUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- bypass = None#
- class chop.nn.quantized.modules.gelu.GELUMinifloatDenorm(inplace: bool = False, config: dict = None)[source]#
Bases:
_GELUBase
- class chop.nn.quantized.modules.gelu.GELUMinifloatIEEE(inplace: bool = False, config: dict = None)[source]#
Bases:
_GELUBase
- class chop.nn.quantized.modules.gelu.GELULog(inplace: bool = False, config: dict = None)[source]#
Bases:
_GELUBase
- class chop.nn.quantized.modules.gelu.GELUBlockFP(inplace: bool = False, config: dict = None)[source]#
Bases:
_GELUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.gelu.GELUBlockMinifloat(inplace: bool = False, config: dict = None)[source]#
Bases:
_GELUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.gelu.GELUBlockLog(inplace: bool = False, config: dict = None)[source]#
Bases:
_GELUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
chop.nn.quantized.modules.group_norm#
chop.nn.quantized.modules.instance_norm2d#
chop.nn.quantized.modules.layer_norm#
chop.nn.quantized.modules.linear#
- class chop.nn.quantized.modules.linear.LinearInteger(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None, out_config=None, floor=False)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None, out_config=None, floor=False) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearMinifloatDenorm(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearMinifloatIEEE(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearLog(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearBlockFP(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearBlockMinifloat(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearBlockLog(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearBinary(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearBinaryScaling(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_LinearBase
Binary scaling variant of the linear transformation layer.
“bypass”: Bypass quantization for standard linear transformation.
“data_in_stochastic”, “bias_stochastic”, “weight_stochastic”: Stochastic settings.
“data_in_bipolar”, “bias_bipolar”, “weight_bipolar”: Bipolar settings.
“binary_training”: Apply binary scaling during training.
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearTernary(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearBinaryResidualSign(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None)[source]#
Bases:
_LinearBase
Binary Linear layer with redisual sign variant of the linear transformation layer.
“bypass”: Bypass quantization for standard linear transformation.
“data_in_stochastic”, “bias_stochastic”, “weight_stochastic”: Stochastic settings.
“data_in_bipolar”, “bias_bipolar”, “weight_bipolar”: Bipolar settings.
“binary_training”: Apply binary scaling during training.
“data_in_levels”: The num of residual layers to use.
“data_in_residual_sign” : Apply residual sign on input
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearLUT(config: None, in_features: int, out_features: int, mask_builder_type: ~typing.Type[~chop.nn.quantizers.LUTNet.MaskBase.MaskBase] = <class 'chop.nn.quantizers.LUTNet.MaskBase.MaskExpanded'>, trainer_type: ~typing.Type[~chop.nn.quantizers.LUTNet.BaseTrainer.BaseTrainer] = <class 'chop.nn.quantizers.LUTNet.BaseTrainer.LagrangeTrainer'>, bias: bool = True, device: str = None)[source]#
Bases:
Module
- mask_builder: MaskBase#
- __init__(config: None, in_features: int, out_features: int, mask_builder_type: ~typing.Type[~chop.nn.quantizers.LUTNet.MaskBase.MaskBase] = <class 'chop.nn.quantizers.LUTNet.MaskBase.MaskExpanded'>, trainer_type: ~typing.Type[~chop.nn.quantizers.LUTNet.BaseTrainer.BaseTrainer] = <class 'chop.nn.quantizers.LUTNet.BaseTrainer.LagrangeTrainer'>, bias: bool = True, device: str = None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- in_features: int#
- out_features: int#
- mask_builder_type: Type[MaskBase]#
- input_mask: Tensor#
- tables_count: int#
- trainer: BaseTrainer#
- forward(input: Tensor, targets: tensor = None, initalize: bool = False)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearLogicNets(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None, activation_module=None, input_layers=None, output_layers=None)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None, activation_module=None, input_layers=None, output_layers=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- table_lookup(connected_input: Tensor, input_perm_matrix: Tensor, bin_output_states: Tensor) Tensor [source]#
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.linear.LinearMXIntHardware(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None, out_config=None)[source]#
Bases:
_LinearBase
- __init__(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, config=None, out_config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
chop.nn.quantized.modules.max_pool2d#
- class chop.nn.quantized.modules.pool2d.AvgPool2dInteger(kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] | None = None, padding: int | Tuple[int, int] = 0, ceil_mode: bool = False, count_include_pad: bool = True, divisor_override: int | None = None, config=None)[source]#
Bases:
_AvgPool2dBase
- __init__(kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] | None = None, padding: int | Tuple[int, int] = 0, ceil_mode: bool = False, count_include_pad: bool = True, divisor_override: int | None = None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.pool2d.AdaptiveAvgPool2dInteger(output_size, config)[source]#
Bases:
_AdaptiveAvgPool2dBase
- class chop.nn.quantized.modules.pool2d.AvgPool2dBinary(kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] | None = None, padding: int | Tuple[int, int] = 0, ceil_mode: bool = False, count_include_pad: bool = True, divisor_override: int | None = None, config=None)[source]#
Bases:
_AvgPool2dBase
- __init__(kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] | None = None, padding: int | Tuple[int, int] = 0, ceil_mode: bool = False, count_include_pad: bool = True, divisor_override: int | None = None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class chop.nn.quantized.modules.pool2d.AvgPool2dTernary(kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] | None = None, padding: int | Tuple[int, int] = 0, ceil_mode: bool = False, count_include_pad: bool = True, divisor_override: int | None = None, config=None)[source]#
Bases:
_AvgPool2dBase
- __init__(kernel_size: int | Tuple[int, int], stride: int | Tuple[int, int] | None = None, padding: int | Tuple[int, int] = 0, ceil_mode: bool = False, count_include_pad: bool = True, divisor_override: int | None = None, config=None) None [source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
chop.nn.quantized.modules.relu#
- class chop.nn.quantized.modules.relu.ReLUInteger(inplace: bool = False, config: dict = None)[source]#
Bases:
_ReLUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- bypass = None#
- class chop.nn.quantized.modules.relu.ReLUMinifloatDenorm(inplace: bool = False, config: dict = None)[source]#
Bases:
_ReLUBase
- class chop.nn.quantized.modules.relu.ReLUMinifloatIEEE(inplace: bool = False, config: dict = None)[source]#
Bases:
_ReLUBase
- class chop.nn.quantized.modules.relu.ReLULog(inplace: bool = False, config: dict = None)[source]#
Bases:
_ReLUBase
- class chop.nn.quantized.modules.relu.ReLUBlockFP(inplace: bool = False, config: dict = None)[source]#
Bases:
_ReLUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.relu.ReLUBlockMinifloat(inplace: bool = False, config: dict = None)[source]#
Bases:
_ReLUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.relu.ReLUBlockLog(inplace: bool = False, config: dict = None)[source]#
Bases:
_ReLUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
chop.nn.quantized.modules.rms_norm#
- class chop.nn.quantized.modules.rms_norm.RMSNorm(normalized_shape, eps: float = 1e-08, elementwise_affine: bool = False, device=None, dtype=None)[source]#
Bases:
Module
Root Mean Square Layer Normalization
- __init__(normalized_shape, eps: float = 1e-08, elementwise_affine: bool = False, device=None, dtype=None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
chop.nn.quantized.modules.selu#
- class chop.nn.quantized.modules.selu.SELUInteger(inplace: bool = False, config: dict = None)[source]#
Bases:
_SELUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- bypass = None#
- class chop.nn.quantized.modules.selu.SELUMinifloatDenorm(inplace: bool = False, config: dict = None)[source]#
Bases:
_SELUBase
- class chop.nn.quantized.modules.selu.SELUMinifloatIEEE(inplace: bool = False, config: dict = None)[source]#
Bases:
_SELUBase
- class chop.nn.quantized.modules.selu.SELULog(inplace: bool = False, config: dict = None)[source]#
Bases:
_SELUBase
- class chop.nn.quantized.modules.selu.SELUBlockFP(inplace: bool = False, config: dict = None)[source]#
Bases:
_SELUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.selu.SELUBlockMinifloat(inplace: bool = False, config: dict = None)[source]#
Bases:
_SELUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.selu.SELUBlockLog(inplace: bool = False, config: dict = None)[source]#
Bases:
_SELUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
chop.nn.quantized.modules.silu#
- class chop.nn.quantized.modules.silu.SiLUInteger(inplace: bool = False, config: dict = None)[source]#
Bases:
_SiLUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- bypass = None#
- class chop.nn.quantized.modules.silu.SiLUMinifloatDenorm(inplace: bool = False, config: dict = None)[source]#
Bases:
_SiLUBase
- class chop.nn.quantized.modules.silu.SiLUMinifloatIEEE(inplace: bool = False, config: dict = None)[source]#
Bases:
_SiLUBase
- class chop.nn.quantized.modules.silu.SiLULog(inplace: bool = False, config: dict = None)[source]#
Bases:
_SiLUBase
- class chop.nn.quantized.modules.silu.SiLUBlockFP(inplace: bool = False, config: dict = None)[source]#
Bases:
_SiLUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.silu.SiLUBlockMinifloat(inplace: bool = False, config: dict = None)[source]#
Bases:
_SiLUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.silu.SiLUBlockLog(inplace: bool = False, config: dict = None)[source]#
Bases:
_SiLUBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
chop.nn.quantized.modules.softplus#
- class chop.nn.quantized.modules.softplus.SoftplusInteger(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftplusBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- bypass = None#
- class chop.nn.quantized.modules.softplus.SoftplusMinifloatDenorm(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftplusBase
- class chop.nn.quantized.modules.softplus.SoftplusMinifloatIEEE(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftplusBase
- class chop.nn.quantized.modules.softplus.SoftplusLog(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftplusBase
- class chop.nn.quantized.modules.softplus.SoftplusBlockFP(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftplusBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.softplus.SoftplusBlockMinifloat(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftplusBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.softplus.SoftplusBlockLog(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftplusBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
chop.nn.quantized.modules.softsign#
- class chop.nn.quantized.modules.softsign.SoftsignInteger(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftsignBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- bypass = None#
- class chop.nn.quantized.modules.softsign.SoftsignMinifloatDenorm(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftsignBase
- class chop.nn.quantized.modules.softsign.SoftsignMinifloatIEEE(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftsignBase
- class chop.nn.quantized.modules.softsign.SoftsignLog(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftsignBase
- class chop.nn.quantized.modules.softsign.SoftsignBlockFP(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftsignBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.softsign.SoftsignBlockMinifloat(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftsignBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.softsign.SoftsignBlockLog(inplace: bool = False, config: dict = None)[source]#
Bases:
_SoftsignBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
chop.nn.quantized.modules.tanh#
- class chop.nn.quantized.modules.tanh.TanhInteger(inplace: bool = False, config: dict = None)[source]#
Bases:
_TanhBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- bypass = None#
- class chop.nn.quantized.modules.tanh.TanhMinifloatDenorm(inplace: bool = False, config: dict = None)[source]#
Bases:
_TanhBase
- class chop.nn.quantized.modules.tanh.TanhMinifloatIEEE(inplace: bool = False, config: dict = None)[source]#
Bases:
_TanhBase
- class chop.nn.quantized.modules.tanh.TanhLog(inplace: bool = False, config: dict = None)[source]#
Bases:
_TanhBase
- class chop.nn.quantized.modules.tanh.TanhBlockFP(inplace: bool = False, config: dict = None)[source]#
Bases:
_TanhBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.tanh.TanhBlockMinifloat(inplace: bool = False, config: dict = None)[source]#
Bases:
_TanhBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class chop.nn.quantized.modules.tanh.TanhBlockLog(inplace: bool = False, config: dict = None)[source]#
Bases:
_TanhBase
- __init__(inplace: bool = False, config: dict = None)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Tensor) Tensor [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.