Merge nucleic/sleek-ember-seal-uady into dev
This commit is contained in:
@@ -74,6 +74,23 @@ class CoreMLQuantizationConfigTests(unittest.TestCase):
|
||||
with self.assertRaisesRegex(DataError, "must not overwrite"):
|
||||
quantize_coreml._validate_args(args)
|
||||
|
||||
def test_calibration_packages_are_removed_after_each_prediction(self):
|
||||
class FakeDebugger:
|
||||
def predict_intermediate_outputs(self):
|
||||
package = Path(tempfile.mkdtemp(suffix=".mlpackage"))
|
||||
(package / "weight.bin").write_bytes(b"weights")
|
||||
return {"output": np.array([1.0])}
|
||||
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
root = Path(temp) / "calibration"
|
||||
with quantize_coreml._bounded_calibration_packages(
|
||||
FakeDebugger,
|
||||
root,
|
||||
):
|
||||
output = FakeDebugger().predict_intermediate_outputs()
|
||||
self.assertEqual([1.0], output["output"].tolist())
|
||||
self.assertEqual([], list(root.glob("*.mlpackage")))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user