Skip to content

Commit

Permalink
compiler: Ensure Weights values are of type sympy
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioLuporini committed Oct 26, 2023
1 parent 36cf0be commit 7fee995
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions devito/finite_differences/differentiable.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,12 +617,13 @@ def __init_finalize__(self, *args, **kwargs):
assert isinstance(d, StencilDimension) and d.symbolic_size == len(weights)
assert isinstance(weights, (list, tuple, np.ndarray))

try:
self._spacings = set().union(*[i.find(Spacing) for i in weights])
except AttributeError:
self._spacing = set()
# Normalize `weights`
weights = tuple(sympy.sympify(i) for i in weights)

self._spacings = set().union(*[i.find(Spacing) for i in weights])

kwargs['scope'] = 'constant'
kwargs['initvalue'] = weights

super().__init_finalize__(*args, **kwargs)

Expand Down

0 comments on commit 7fee995

Please sign in to comment.