docstr: extended torch.nn module which mask connection.
  Argumens
  ------------------
  mask [torch.tensor]:
      the shape is (n_input_feature, n_output_feature).
      the elements are 0 or 1 which declare un-connected or
      connected.
  bias [bool]:
      flg of bias.
docstr_tok: ["extended","torch.nn","module","which","mask","connection",".","Argumens","--","--","--","--","--","--","--","--","--","mask","[","torch.tensor","]",":","the","shape","is","(","n_input_feature",",","n_output_feature",")",".","the","elements","are","0","or","1","which","declare","un-connected","or","connected",".","bias","[","bool","]",":","flg","of","bias","."]
code: def __init__(self, mask, bias=True):
      """
      extended torch.nn module which mask connection.
      Argumens
      ------------------
      mask [torch.tensor]:
          the shape is (n_input_feature, n_output_feature).
          the elements are 0 or 1 which declare un-connected or
          connected.
      bias [bool]:
          flg of bias.
      """
      super(CustomizedLinear, self).__init__()
      self.input_features = mask.shape[0]
      self.output_features = mask.shape[1]
      if isinstance(mask, torch.Tensor):
          self.mask = mask.type(torch.float).t()
      else:
          self.mask = torch.tensor(mask, dtype=torch.float).t()
  
      self.mask = nn.Parameter(self.mask, requires_grad=False)
  
      # nn.Parameter is a special kind of Tensor, that will get
      # automatically registered as Module's parameter once it's assigned
      # as an attribute. Parameters and buffers need to be registered, or
      # they won't appear in .parameters() (doesn't apply to buffers), and
      # won't be converted when e.g. .cuda() is called. You can use
      # .register_buffer() to register buffers.
      # nn.Parameters require gradients by default.
      self.weight = nn.Parameter(
          torch.Tensor(self.output_features, self.input_features)
      )
  
      if bias:
          self.bias = nn.Parameter(torch.Tensor(self.output_features))
      else:
          # You should always register all possible parameters, but the
          # optional ones can be None if you want.
          self.register_parameter("bias", None)
      self.reset_parameters()
  
file_path: AIX360/aix360/algorithms/cofrnet/CustomizedLinearClasses.py
imports: import pandas
  import numpy
  import pandas
  import torch
  import torch.nn
  import torch.autograd
  from torch.autograd import Function
  from torch.nn.parameter import Parameter
  import torch.nn.functional
  import math
label_desc: Use image node_id 1 to create a new CustomizedLinear object from inherited base classes: nn with example: obj = CustomizedLinear(mask, bias)