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,7 +1,5 @@
|
||||
"""Module for PINA Torch Optimizer"""
|
||||
|
||||
import torch
|
||||
|
||||
try:
|
||||
from torch.optim.lr_scheduler import LRScheduler # torch >= 2.0
|
||||
except ImportError:
|
||||
@@ -15,8 +13,20 @@ from .scheduler_interface import Scheduler
|
||||
|
||||
|
||||
class TorchScheduler(Scheduler):
|
||||
"""
|
||||
TODO
|
||||
|
||||
:param Scheduler: _description_
|
||||
:type Scheduler: _type_
|
||||
"""
|
||||
|
||||
def __init__(self, scheduler_class, **kwargs):
|
||||
"""
|
||||
TODO
|
||||
|
||||
:param scheduler_class: _description_
|
||||
:type scheduler_class: _type_
|
||||
"""
|
||||
check_consistency(scheduler_class, LRScheduler, subclass=True)
|
||||
|
||||
self.scheduler_class = scheduler_class
|
||||
@@ -24,6 +34,12 @@ class TorchScheduler(Scheduler):
|
||||
self._scheduler_instance = None
|
||||
|
||||
def hook(self, optimizer):
|
||||
"""
|
||||
TODO
|
||||
|
||||
:param optimizer: _description_
|
||||
:type optimizer: _type_
|
||||
"""
|
||||
check_consistency(optimizer, Optimizer)
|
||||
self._scheduler_instance = self.scheduler_class(
|
||||
optimizer.instance, **self.kwargs
|
||||
|
||||
Reference in New Issue
Block a user