Skip to content

Commit

Permalink
Fixed bug in how constants are broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
iguinn committed Jan 2, 2024
1 parent 9843a24 commit ce5ca0a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/dspeed/processing_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,18 +1405,19 @@ def __init__(
is_coord=is_coord,
)

arshape = list(param.shape)
param = param.get_buffer(grid)

# reshape just in case there are some missing dimensions
arshape = list(param.shape)
for idim in range(-1, -1 - len(shape), -1):
if (
len(arshape) < len(shape) + 1 + idim
or arshape[idim] != shape[idim]
):
arshape.insert(len(arshape) + idim + 1, 1)
print(arshape)
param = param.reshape(tuple([self.proc_chain._block_width] + arshape))

if param.is_const:
param = param.get_buffer(grid).reshape(arshape)
else:
param = param.get_buffer(grid).reshape(tuple([self.proc_chain._block_width] + arshape))

elif isinstance(param, str):
# Convert string into integer buffer if appropriate
Expand Down

0 comments on commit ce5ca0a

Please sign in to comment.