If I just guess some input parameters and shapes, your code seems to work:
model = SudokuSolver(5, 5, 2)
train_data = torch.randn(10, 5)
train_labels = torch.randint(0, 2, (10, 10)).float()
model.train(train_data, train_labels, verbose=1)

Could you check what’s different and correct some parameters?