summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--polymatrix/expression/from_.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/polymatrix/expression/from_.py b/polymatrix/expression/from_.py
index ce35a83..03091c7 100644
--- a/polymatrix/expression/from_.py
+++ b/polymatrix/expression/from_.py
@@ -117,6 +117,16 @@ def from_name(
if isinstance(shape, Expression):
shape = shape.underlying
+ elif isinstance(shape, tuple):
+ nrows, ncols = shape
+ if isinstance(nrows, Expression):
+ nrows = nrows.underlying
+
+ if isinstance(ncols, Expression):
+ ncols = ncols.underlying
+
+ shape = (nrows, ncols)
+
return init_variable_expression(init.init_variable_expr(Symbol(name), shape))