Skip to content

Commit f6c8de7

Browse files
committed
Fixes one of the many problems caused by sandialabs#368. Just create an array of the appropriate length using the function, and then reshape it.
1 parent 97d2229 commit f6c8de7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pyttb/tensor.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ def from_function(
253253
shape = parse_shape(shape)
254254

255255
# Generate data
256-
data = function_handle(shape)
256+
totalsize = prod(shape)
257+
data = function_handle((totalsize,))
257258

258259
# Create the tensor
259260
return cls(data, shape, copy=False)

0 commit comments

Comments
 (0)