def compare_and_validate_results(float_model, q_model):
     weight_dict = compare_weights_fx(float_model.state_dict(),
                                      q_model.state_dict())
     self.assertEqual(len(weight_dict), 1)
     for k, v in weight_dict.items():
         self.assertTrue(len(v["float"]) == len(v["quantized"]))
         for i, val in enumerate(v["quantized"]):
             self.assertTrue(
                 v["float"][i].shape == v["quantized"][i].shape)
    def compare_and_validate_model_weights_results_fx(
        self, float_model, q_model, expected_weight_dict_keys
    ):
        weight_dict = compare_weights_fx(float_model.state_dict(), q_model.state_dict())

        self.assertTrue(weight_dict.keys() == expected_weight_dict_keys)
        self.assertEqual(len(weight_dict), 1)

        for k, v in weight_dict.items():
            self.assertTrue(v["float"].shape == v["quantized"].shape)