def test_batchnorm_fp16_weight_with_fp32_param(self, compute_unit, backend, frontend):
        """
        With `.half()`, torch will still leave batchnorm's params (such as eps) as fp32.
        This test makes sure the fp16 weight works with those fp32 params during conversion.
        """
        class TestModel(nn.Module):
            def __init__(self, embedding_size: int, hidden_layers_sizes: List[int]):
                super(TestModel, self).__init__()

                layers: List[nn.Module] = []
                previous_size = embedding_size
                for size in hidden_layers_sizes:
                    layers.append(nn.Linear(previous_size, size))
                    layers.append(nn.ReLU())
                    layers.append(nn.BatchNorm1d(size))
                    previous_size = size
                layers.append(nn.Linear(previous_size, 1))
                layers.append(nn.Sigmoid())

                self.network = nn.Sequential(*layers)

            def forward(self, x):
                x = x.view(x.size(0), -1)
                x = self.network(x)
                return x

        torch_model_fp32 = TestModel(
            embedding_size=512,
            hidden_layers_sizes=[1024, 256, 128, 64],
        )
        torch_model_fp32.eval()
        torch_model_fp16 = torch_model_fp32.half()

        example_input = torch.rand(1, 512).half()
        expected_results = torch_model_fp16(example_input)
        self.run_compare_torch(
            example_input,
            torch_model_fp16,
            expected_results=expected_results,
            input_as_shape=False,
            frontend=frontend,
            backend=backend,
            compute_unit=compute_unit,
            minimum_deployment_target=ct.target.iOS17,
        )

        With `.half()`, torch will still leave batchnorm's params (such as eps) as fp32.
        This test makes sure the fp16 weight works with those fp32 params during conversion.
        
coremltools/converters/mil/frontend/torch/test/test_torch_ops.py