Describe the bug
When training with RBAPINN, if the selected accelerator is not cpu (e.g., "cuda"), the residual-based weight buffers are not properly moved to the correct device. As a result, a device mismatch error occurs during training, preventing execution from continuing.
To Reproduce
from pina.problem.zoo import Poisson2DSquareProblem as Poisson
from pina.model import FeedForward
from pina.solver import RBAPINN
from pina import Trainer
# Define the problem
problem = Poisson()
problem.discretise_domain(n=50, mode="grid")
# Define the model and the solver
model = FeedForward(2, 1, 64, 2)
solver = RBAPINN(problem=problem, model=model)
# Initialize the trainer and begin training
trainer = Trainer(solver=solver, max_epochs=100, accelerator="cuda", devices=1)
trainer.train()
Expected behavior
Training should proceed without device mismatch errors, and all internal buffers should be moved automatically to the specified accelerator prior to training.
Describe the bug
When training with
RBAPINN, if the selected accelerator is not cpu (e.g., "cuda"), the residual-based weight buffers are not properly moved to the correct device. As a result, a device mismatch error occurs during training, preventing execution from continuing.To Reproduce
Expected behavior
Training should proceed without device mismatch errors, and all internal buffers should be moved automatically to the specified accelerator prior to training.