From 3991ed3b38f4f4923e39f2cf9cc71a0693c9bd32 Mon Sep 17 00:00:00 2001 From: Benoit Chevallier-Mames Date: Tue, 2 Nov 2021 14:31:53 +0100 Subject: [PATCH] chore: np.tranpose, np.reshape and np.ravel don't compile currently. --- tests/numpy/test_compile.py | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/numpy/test_compile.py b/tests/numpy/test_compile.py index 9fbaa3014..10890fd62 100644 --- a/tests/numpy/test_compile.py +++ b/tests/numpy/test_compile.py @@ -953,6 +953,45 @@ return(%1) """.lstrip() # noqa: E501 ), ), + pytest.param( + lambda x: numpy.transpose(x), + {"x": EncryptedTensor(Integer(3, is_signed=False), shape=(3, 2))}, + [(numpy.random.randint(0, 2 ** 3, size=(3, 2)),) for i in range(10)], + ( + "function you are trying to compile isn't supported for MLIR lowering\n" + "\n" + "%0 = x # EncryptedTensor, shape=(3, 2)>\n" # noqa: E501 + "%1 = np.transpose(%0) # EncryptedTensor, shape=(2, 3)>\n" # noqa: E501 + "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ np.transpose is not supported for the time being\n" # noqa: E501 + "return(%1)\n" + ), + ), + pytest.param( + lambda x: numpy.ravel(x), + {"x": EncryptedTensor(Integer(3, is_signed=False), shape=(3, 2))}, + [(numpy.random.randint(0, 2 ** 3, size=(3, 2)),) for i in range(10)], + ( + "function you are trying to compile isn't supported for MLIR lowering\n" + "\n" + "%0 = x # EncryptedTensor, shape=(3, 2)>\n" # noqa: E501 + "%1 = np.ravel(%0) # EncryptedTensor, shape=(6,)>\n" # noqa: E501 + "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ np.ravel is not supported for the time being\n" # noqa: E501 + "return(%1)\n" + ), + ), + pytest.param( + lambda x: numpy.reshape(x, (2, 6)), + {"x": EncryptedTensor(Integer(3, is_signed=False), shape=(3, 4))}, + [(numpy.random.randint(0, 2 ** 3, size=(3, 4)),) for i in range(10)], + ( + "function you are trying to compile isn't supported for MLIR lowering\n" + "\n" + "%0 = x # EncryptedTensor, shape=(3, 4)>\n" # noqa: E501 + "%1 = np.reshape(%0) # EncryptedTensor, shape=(2, 6)>\n" # noqa: E501 + "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ np.reshape is not supported for the time being\n" # noqa: E501 + "return(%1)\n" + ), + ), ], ) # pylint: enable=line-too-long