Skip to content

Commit 1a4cd17

Browse files
committed
guard against empty shape arrays by setting initial value in reduce operations over state dimensions in State
1 parent 55c30c1 commit 1a4cd17

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pydra/engine/state.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,12 +1150,12 @@ def _processing_terms(self, term, previous_states_ind):
11501150
else:
11511151
container_ndim = self.container_ndim_all.get(term, 1)
11521152
shape = input_shape(self.inputs[term], container_ndim=container_ndim)
1153-
var_ind = range(reduce(lambda x, y: x * y, shape))
1153+
var_ind = range(reduce(lambda x, y: x * y, shape, 1))
11541154
new_keys = [term]
11551155
# checking if the term is in inner_inputs
11561156
if term in self.inner_inputs:
11571157
# TODO: have to be changed if differ length
1158-
inner_len = [shape[-1]] * reduce(lambda x, y: x * y, shape[:-1])
1158+
inner_len = [shape[-1]] * reduce(lambda x, y: x * y, shape[:-1], 1)
11591159
# this come from the previous node
11601160
outer_ind = self.inner_inputs[term].ind_l
11611161
var_ind_out = itertools.chain.from_iterable(
@@ -1172,7 +1172,7 @@ def _single_op_splits(self, op_single):
11721172
self.inputs[op_single],
11731173
container_ndim=self.container_ndim_all.get(op_single, 1),
11741174
)
1175-
val_ind = range(reduce(lambda x, y: x * y, shape))
1175+
val_ind = range(reduce(lambda x, y: x * y, shape, 1))
11761176
if op_single in self.inner_inputs:
11771177
# TODO: have to be changed if differ length
11781178
inner_len = [shape[-1]] * reduce(lambda x, y: x * y, shape[:-1], 1)

0 commit comments

Comments
 (0)