__init__() got an unexpected keyword argument 'chi1'
I am new in python. I am trying to import arguments into my class &quot;inverse_model&quot; . I call a function &quot;get_models&quot; to do that. But it gives me the error &quot;init() got an unexpected keyword argument 'zz':
I appreciate help. Please see code below:
    def get_models(args):
    
    
    zz=torch.tensor(args.chi_Initialize)
    inverse_net = inverse_model(in_channels=len(args.chi),zz=zz,resolution_ratio=args.resolution_ratio,nonlinearity=args.nonlinearity)
    
    return inverse_net


class inverse_model(nn.Module):
    def __init__(self, in_channels,zz,resolution_ratio=6,nonlinearity=&quot;tanh&quot;):
        super(inverse_model, self).__init__()
        self.in_channels = in_channels
        self.zz=zz
        self.resolution_ratio = resolution_ratio #vertical scale mismtach between seismic and EI
        self.activation =  nn.ReLU() if nonlinearity==&quot;relu&quot; else nn.Tanh() 


After default argument, python does not allow to have non default argument.
Modify your constructor to
def __init__(self, in_channels,
                 chi1,chi2,chi3,chi4,chi5,chi6,chi7,chi8,chi9,
                 chi10,chi11,chi12, resolution_ratio=6,nonlinearity=&quot;tanh&quot;):

Updated answer : Revision 1 (updated question)
import torch
from torch import nn


class inverse_model(nn.Module):
    def __init__(self, in_channels, zz, resolution_ratio=6, nonlinearity=&quot;tanh&quot;):
        super(inverse_model, self).__init__()
        self.in_channels = in_channels
        self.zz = zz
        self.resolution_ratio = resolution_ratio  # vertical scale mismtach between seismic and EI
        self.activation = nn.ReLU() if nonlinearity == &quot;relu&quot; else nn.Tanh()

def get_models(args):
    zz = torch.tensor(args.chi_Initialize)
    inverse_net = inverse_model(in_channels=len(args.chi), zz=zz, resolution_ratio=args.resolution_ratio,
                                nonlinearity=args.nonlinearity)

    return inverse_net

It returns exit 0 as status.
