def test_dynamic_activation_quantization_not_support(self, use_export):
        """
        Although Int8DynActInt4WeightQuantizer will be deprecated, we still want
        to test it because it's used in ExecuTorch to quantize llama models.
        """
        model = self._construct_test_model()
        quantizer = quant_api.Int8DynActInt4WeightQuantizer(
            precision=torch.float16, groupsize=32, device=torch.device("cpu")
        )
        model = quantizer.quantize(model)
        input_data = torch.randn((2, 32), dtype=torch.float16)

        if use_export:
            exported_model = torch.export.export(model, (input_data,))
            inputs = None
            err_msg = "Unsupported fx node quantize_per_token"
            err_type = ValueError
        else:
            exported_model = torch.jit.trace(model, example_inputs=(input_data,))
            inputs = [ct.TensorType(shape=input_data.shape)]
            err_msg = "Dynamic activation quantization is not supported in Core ML"
            err_type = NotImplementedError

        with pytest.raises(err_type, match=err_msg):
            ct.convert(exported_model, inputs=inputs, minimum_deployment_target=ct.target.iOS17)

        Although Int8DynActInt4WeightQuantizer will be deprecated, we still want
        to test it because it's used in ExecuTorch to quantize llama models.
        
coremltools/converters/mil/frontend/torch/test/test_torch_conversion_api.py