libmultilabel/model.py
def configure_optimizers(self):
        """Initialize an optimizer for the free parameters of the network.
        """
        parameters = [p for p in self.parameters() if p.requires_grad]
        optimizer_name = self.optimizer
        if optimizer_name == 'sgd':
            optimizer = optim.SGD(parameters, self.learning_rate,
                                  momentum=self.momentum,
                                  weight_decay=self.weight_decay)
        elif optimizer_name == 'adam':
            optimizer = optim.Adam(parameters,
                                   weight_decay=self.weight_decay,
                                   lr=self.learning_rate)
        elif optimizer_name == 'adamw':
            optimizer = optim.AdamW(parameters,
                                    weight_decay=self.weight_decay,
                                    lr=self.learning_rate)
        else:
            raise RuntimeError(
                'Unsupported optimizer: {self.optimizer}')

        torch.nn.utils.clip_grad_value_(parameters, 0.5)

        return optimizer
Initialize an optimizer for the free parameters of the network.
        
Initialize an optimizer for the free parameters of the network.
Initialize an optimizer for the free parameters of the network .
def configure_optimizers(self):
        parameters = [p for p in self.parameters() if p.requires_grad]
        optimizer_name = self.optimizer
        if optimizer_name == 'sgd':
            optimizer = optim.SGD(parameters, self.learning_rate,
                                  momentum=self.momentum,
                                  weight_decay=self.weight_decay)
        elif optimizer_name == 'adam':
            optimizer = optim.Adam(parameters,
                                   weight_decay=self.weight_decay,
                                   lr=self.learning_rate)
        elif optimizer_name == 'adamw':
            optimizer = optim.AdamW(parameters,
                                    weight_decay=self.weight_decay,
                                    lr=self.learning_rate)
        else:
            raise RuntimeError(
                'Unsupported optimizer: {self.optimizer}')
        torch.nn.utils.clip_grad_value_(parameters, 0.5)
        return optimizer
def configure_optimizers ( self ) : parameters = [ p for p in self . parameters ( ) if p . requires_grad ] optimizer_name = self . optimizer if optimizer_name == 'sgd' : optimizer = optim . SGD ( parameters , self . learning_rate , momentum = self . momentum , weight_decay = self . weight_decay ) elif optimizer_name == 'adam' : optimizer = optim . Adam ( parameters , weight_decay = self . weight_decay , lr = self . learning_rate ) elif optimizer_name == 'adamw' : optimizer = optim . AdamW ( parameters , weight_decay = self . weight_decay , lr = self . learning_rate ) else : raise RuntimeError ( 'Unsupported optimizer: {self.optimizer}' ) torch . nn . utils . clip_grad_value_ ( parameters , 0.5 ) return optimizer
Initialize an optimizer for the free parameters of the network.
Initialize an optimizer for the free parameters of the network .
"""Initialize an optimizer for the free parameters of the network.
        """
self