-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Now, expressions can be saved only if they consist of a complex expression, but not a simple one (e.g. a single function). The next script shows the issue:
import blosc2
import numpy as np
N = 10
shape_a = (N, N, N)
matrix_numpy = np.ones(N ** 3).reshape(shape_a)
matrix_a = blosc2.asarray(matrix_numpy, urlpath="a.b2nd", mode="w")
matrix_b = blosc2.asarray(matrix_numpy, urlpath="b.b2nd", mode="w")
# Create a lazy expression object
sexpr = "matrix_a.sum() + matrix_b" # this works
# sexpr = "sum(matrix_a)" # this does not
# sexpr = "tensordot(matrix_a, matrix_b, axes=((0, 1), (0, 1)))" # this does not
lexpr=blosc2.lazyexpr(sexpr,
operands={"matrix_a": matrix_a, "matrix_b": matrix_b})
lexpr.save("persistent_expr.b2nd")
lexpr2 = blosc2.open("persistent_expr.b2nd", mode="r")
print(lexpr2[:])
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request