Fix Codacy Warnings (#477)
--------- Co-authored-by: Dario Coscia <dariocos99@gmail.com>
This commit is contained in:
committed by
Nicola Demo
parent
e3790e049a
commit
4177bfbb50
@@ -1,4 +1,3 @@
|
||||
|
||||
import torch
|
||||
import pytest
|
||||
from pina.optim import TorchOptimizer, TorchScheduler
|
||||
@@ -7,21 +6,21 @@ opt_list = [
|
||||
torch.optim.Adam,
|
||||
torch.optim.AdamW,
|
||||
torch.optim.SGD,
|
||||
torch.optim.RMSprop
|
||||
torch.optim.RMSprop,
|
||||
]
|
||||
|
||||
sch_list = [
|
||||
torch.optim.lr_scheduler.ConstantLR
|
||||
]
|
||||
sch_list = [torch.optim.lr_scheduler.ConstantLR]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("scheduler_class", sch_list)
|
||||
def test_constructor(scheduler_class):
|
||||
TorchScheduler(scheduler_class)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("optimizer_class", opt_list)
|
||||
@pytest.mark.parametrize("scheduler_class", sch_list)
|
||||
def test_hook(optimizer_class, scheduler_class):
|
||||
opt = TorchOptimizer(optimizer_class, lr=1e-3)
|
||||
opt.hook(torch.nn.Linear(10, 10).parameters())
|
||||
sch = TorchScheduler(scheduler_class)
|
||||
sch.hook(opt)
|
||||
sch.hook(opt)
|
||||
|
||||
Reference in New Issue
Block a user