Thank you for the reply @ptrblck.
I am a newbie, I followed your suggestion and these links: link1 1 and link2
Can you please look at below code and suggest changes?
class Conv(torch.nn.Module):

    def __init__(self, in_channels, out_channels, kernel_size, stride, padding, bias):
        
        super(Conv, self).__init__()
        
        self.in_channels = in_channels
        self.out_channels = out_channels
        self.kernel_size = kernel_size
        self.stride = stride
        self.padding = padding
        self.weight = torch.nn.Parameter(torch.Tensor(out_channels, in_channels, kernel_size, kernel_size))
        self.bias = torch.nn.Parameter(torch.Tensor(out_channels))
        self.reset_parameters()

    def reset_parameters(self):
        torch.nn.init.kaiming_uniform_(self.weight, a= math.sqrt(5))
        if self.bias is not None:
            fan_in, _ = torch.nn.init._calculate_fan_in_and_fan_out(self.weight)
            bound = 1 / math.sqrt(fan_in)
            torch.nn.init.uniform_(self.bias, -bound, bound)

    def extra_repr(self):
        args = ('{in_channels}, {out_channels}, kernel_size={kernel_size}'
             ', stride={stride}')
        if self.padding != (0,) * len(self.padding):
            args += ', padding={padding}'
        return args.format(**self.__dict__)

    def __setstate__(self, state):
        super(Conv, self).__setstate__(state)
        if not hasattr(self, 'padding_mode'):
            self.padding_mode = 'zeros'
            
            
class Conv2d(Conv):
    def __init__(self, in_channels, out_channels, kernel_size, stride, padding, bias = True):
        super(Conv2d, self).__init__(in_channels, out_channels, kernel_size, stride, padding, bias)

    def conv_forward(self, input, weight):
        return torch.nn.functional.conv2d(input, weight, self.bias, self.stride, self.padding)

    def forward(self, input):
        return self.conv_forward(input, self.weight)


class B_Norm(torch.nn.Module):
    
    def __init__(self, num_channels, eps=1e-5, momentum=0.1, affine=True, track_running_stats=True):
        super(B_Norm, self).__init__()
        self.num_channels = num_channels
        self.eps = eps
        self.momentum = momentum
        self.affine = affine
        self.track_running_stats = track_running_stats
        
        if self.affine:
            self.weight = torch.nn.Parameter(torch.Tensor(num_channels))
            self.bias = torch.nn.Parameter(torch.Tensor(num_channels))
        else:
            self.register_parameter('weight', None)
            self.register_parameter('bias', None)
            
        if self.track_running_stats:
            self.register_buffer('running_mean', torch.zeros(num_channels))
            self.register_buffer('running_var', torch.ones(num_channels))
            self.register_buffer('num_batches_tracked', torch.tensor(0, dtype=torch.long))
        else:
            self.register_parameter('running_mean', None)
            self.register_parameter('running_var', None)
            self.register_parameter('num_batches_tracked', None)
        self.reset_parameters()

    def reset_running_stats(self):
        if self.track_running_stats:
            self.running_mean.zero_()
            self.running_var.fill_(1)
            self.num_batches_tracked.zero_()

    def reset_parameters(self):
        self.reset_running_stats()
        if self.affine:
            self.weight.data.uniform_()
            self.bias.data.zero_()

    def forward(self, input):
       
        exp_avg_factor = 0.0

        if self.training and self.track_running_stats:
            self.num_batches_tracked += 1
            if self.momentum is None:  #cumulative moving average
                exp_avg_factor = 1.0 / self.num_batches_tracked.item()
            else:  # exponential moving average
                exp_avg_factor = self.momentum

        return torch.nn.functional.batch_norm(input, self.running_mean, self.running_var, self.weight, self.bias,
            self.training or not self.track_running_stats, exp_avg_factor, self.eps)

class Net(torch.nn.Module):
    def __init__(self, in_channels, out_channels, kernel_size, stride, padding, kernel_size_p, stride_p, drop_out):
        super(Net,self).__init__()
 
        # self.conv_1_weight = torch.randn(out_channels, in_channels, kernel_size, kernel_size)
        # self.bias_1_weight = torch.randn(out_channels)
 
        # self.conv_2_weight = torch.randn(out_channels*2, out_channels, kernel_size, kernel_size)
        # self.bias_2_weight = torch.randn(out_channels*2)
        
        # self.conv_3_weight = torch.randn(out_channels*3, out_channels*2, kernel_size, kernel_size)
        # self.bias_3_weight = torch.randn(out_channels*3)
 
        # self.conv_4_weight = torch.randn(out_channels*4, out_channels*3, kernel_size, kernel_size)
        # self.bias_4_weight = torch.randn(out_channels*4)
        
        # self.conv_5_weight = torch.randn(10, out_channels*4, 4, 4)
        # self.bias_5_weight = torch.randn(10)
 
    def forward(self, x):
        x = x.view(x.size(0), 3, 32, 32)
        out = Conv2d(x, in_channels, out_channels, kernel_size, stride, padding, bias = True)
        out = B_Norm(out, out_channels, eps=1e-5, momentum=0.1, affine=True, track_running_stats=True)
        out = torch.nn.functional.dropout2d(out, p=drop_out ,training=True)
        out = torch.nn.functional.relu(out, inplace=False)
        
        out = Conv2d(out, out_channels, out_channels*2, kernel_size, stride, padding, bias = True)
        out = B_Norm(out,out_channels*2, eps=1e-5, momentum=0.1, affine=True, track_running_stats=True)
        out = torch.nn.functional.dropout2d(out, p=drop_out, training=True)
        out = torch.nn.functional.relu(out, inplace=False)
        out = torch.nn.functional.max_pool2d(out, kernel_size_p, stride_p)
        
        out = Conv2d(out, out_channels*2, out_channels*3, kernel_size, stride, padding, bias = True)
        out = B_Norm(out, out_channels*3, eps=1e-5, momentum=0.1, affine=True, track_running_stats=True)
        out = torch.nn.functional.dropout2d(out, p=drop_out, training=True)
        out = torch.nn.functional.relu(out, inplace=False)
        
        out = Conv2d(out, out_channels*3, out_channels*4, kernel_size, stride, padding, bias = True)
        out = B_Norm(out, out_channels*4, eps=1e-5, momentum=0.1, affine=True, track_running_stats=True)
        out = torch.nn.functional.dropout2d(out, p=drop_out, training=True)
        out = torch.nn.functional.relu(out, inplace=False)
        
        out = Conv2d(out, out_channels*4, 10, 4, stride, padding, bias= True)
        out = out.view(out.size(0), -1) 
        return out
        
      

But, I’m getting this error: ValueError: optimizer got an empty parameter list