Skip to content

Quantization trait: Directly give output scaling factors #178

@nikkolasg

Description

@nikkolasg

Right now, the framework forces every layer to do the following to get the corresponding output scaling factors:

fn quantize_op<S: ScalingStrategy>(
        self,
        data: &S::AuxData,
        node_id: NodeId,
        input_scaling: &[ScalingFactor],
    ) -> anyhow::Result<QuantizeOutput<Self::QuantizedOp>> {
        let mut output_scalings = S::scaling_factors_for_node(data, node_id, 1);
        ensure!(
            output_scalings.len() == 1,
            "Output scaling for convolution layer different from 1"
        );
     ...

The process could be streamlined if we directly give the output scaling factors as well, since the trait ScalingStrategy can only be used for that anyway.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions