From 5e5097966c1af7c1849dd8bf7d26b35af148b2c5 Mon Sep 17 00:00:00 2001 From: Matthias Diener <mdiener@illinois.edu> Date: Wed, 16 Jun 2021 13:59:35 -0500 Subject: [PATCH] some compile fixes --- arraycontext/impl/pytato.py | 4 ++-- test/test_arraycontext.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arraycontext/impl/pytato.py b/arraycontext/impl/pytato.py index cb6a588..7d4f09f 100644 --- a/arraycontext/impl/pytato.py +++ b/arraycontext/impl/pytato.py @@ -261,8 +261,8 @@ class PytatoCompiledOperator: if not is_array_container(outputs): # TODO: We could possibly just short-circuit this interface if the # returned type is a scalar. Not sure if it's worth it though. - raise ValueError(f"Function {self.f.__name__} to be compiled did not" - " return an array container.") + raise ValueError(f"Function '{self.f.__name__}' to be compiled did not" + f" return an array container, but '{outputs}' instead.") def _as_dict_of_named_arrays(keys, ary): name = "_pt_out_" + "_".join(str(key) diff --git a/test/test_arraycontext.py b/test/test_arraycontext.py index 5623fed..2fb7ea0 100644 --- a/test/test_arraycontext.py +++ b/test/test_arraycontext.py @@ -759,6 +759,7 @@ def test_norm_ord_none(actx_factory, ndim): class Velocity2D: u: np.ndarray v: np.ndarray + array_context: ArrayContext def scale_and_to_speed(alpha, vel): @@ -777,7 +778,9 @@ def test_actx_compile(actx_factory): v_x = np.random.rand(10) v_y = np.random.rand(10) - vel = actx.from_numpy(Velocity2D(v_x, v_y)) + from arraycontext import from_numpy + + vel = from_numpy(Velocity2D(v_x, v_y, actx), actx) scaled_speed = compiled_rhs(3.14, vel) -- GitLab