diff options
-rw-r--r-- | polymatrix/polymatrix/init.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/polymatrix/polymatrix/init.py b/polymatrix/polymatrix/init.py index 6d9adaf..07ceb4c 100644 --- a/polymatrix/polymatrix/init.py +++ b/polymatrix/polymatrix/init.py @@ -8,6 +8,10 @@ def init_poly_matrix( data: PolyMatrixDict, shape: tuple[int, int], ): + # This is here because the old code in expression.mixins usually gives raw dictionaries + if not isinstance(data, PolyMatrixDict): + data = PolyMatrixDict(data) + return PolyMatrixImpl( data=data, shape=shape, @@ -18,6 +22,10 @@ def init_broadcast_poly_matrix( data: PolyDict, shape: tuple[int, int], ) -> BroadcastPolyMatrixMixin: + # This is here because the old code in expression.mixins usually gives raw dictionaries + if not isinstance(data, PolyDict): + data = PolyDict(data) + return BroadcastPolyMatrixImpl( data=data, shape=shape, |