Skip to content

Commit c70ba92

Browse files
authored
Fix string formatting for error messages
1 parent 445e389 commit c70ba92

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

torch_fenics/torch_fenics.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ def forward(ctx, fenics_solver, *args):
2727
expected_nargs = len(fenics_solver.fenics_input_templates())
2828
if n_args != expected_nargs:
2929
raise ValueError(f'Wrong number of arguments to {fenics_solver}.'
30-
' Expected {expected_nargs} got {n_args}.')
30+
f' Expected {expected_nargs} got {n_args}.')
3131

3232
# Check that each input argument has correct dimensions
3333
for i, (arg, template) in enumerate(zip(args, fenics_solver.numpy_input_templates())):
3434
if arg.shape != template.shape:
3535
raise ValueError(f'Expected input shape {template.shape} for input'
36-
' {i} but got {arg.shape}.')
36+
f' {i} but got {arg.shape}.')
3737

3838
# Check that the inputs are of double precision
3939
for i, arg in enumerate(args):
4040
if (isinstance(arg, np.ndarray) and arg.dtype != np.float64) or \
4141
(torch.is_tensor(arg) and arg.dtype != torch.float64):
4242
raise TypeError(f'All inputs must be type {torch.float64},'
43-
' but got {arg.dtype} for input {i}.')
43+
f' but got {arg.dtype} for input {i}.')
4444

4545
# Convert input tensors to corresponding FEniCS variables
4646
fenics_inputs = []

0 commit comments

Comments
 (0)