class_docstr: BimodalInteractionFusion is a PyTorch module that performs fusion of two data modalities through a
  hypernetwork-based interaction mechanism. The 'input_dims' argument specifies the input dimensions of the two
  modalities. The 'output_dim' argument specifies the output dimension after the fusion. The 'output' argument
  defines the type of bimodal matrix interactions to be performed, which can be 'matrix', 'vector', or 'scalar'.
      This fusion method  supports three types of bimodal interactions:
          - Matrix: It implements a general hypernetwork mechanism where the interaction is multiplicative. It uses
          separate weight matrices and biases for the two modalities.
          - Vector: It uses diagonal forms and gating mechanisms, applying element-wise multiplication to combine the
          modalities.
          - Scalar: It applies scales and biases to the input modalities before combining them.
      This fusion method uses xavier normal distribution for initializing the weight matrices and normal distribution
      for the biases. It also provides options to clip the parameter values and their gradients within specified
      ranges to prevent them from exploding or vanishing.
      This fusion approach allows for complex interactions between the modalities and is well-suited for tasks that
      require the integration of heterogeneous data.
  Args:
      input_dims (int): list or tuple of 2 integers indicating input dimensions of the 2 modalities
      output_dim (int): output dimension after the fusion
      output (str): type of BimodalMatrix Interactions, options from 'matrix','vector','scalar'
      flatten (bool): whether we need to flatten the input modalities
      clip (tuple, optional): clip parameter values, None if no clip
      grad_clip (tuple, optional): clip grad values, None if no clip
      flip (bool): whether to swap the two input modalities in forward function or not
code: def __init__(
      self,
      input_dims,
      output_dim,
      output,
      flatten=False,
      clip=None,
      grad_clip=None,
      flip=False,
  ):
      super(BimodalInteractionFusion, self).__init__()
      self.input_dims = input_dims
      self.clip = clip
      self.output_dim = output_dim
      self.output = output
      self.flatten = flatten
      if output == "matrix":
          self.W = nn.Parameter(
              torch.Tensor(input_dims[0], input_dims[1], output_dim)
          )
          nn.init.xavier_normal_(self.W)
          self.U = nn.Parameter(torch.Tensor(input_dims[0], output_dim))
          nn.init.xavier_normal_(self.U)
          self.V = nn.Parameter(torch.Tensor(input_dims[1], output_dim))
          nn.init.xavier_normal_(self.V)
          self.b = nn.Parameter(torch.Tensor(output_dim))
          nn.init.normal_(self.b)
      elif output == "vector":
          self.W = nn.Parameter(
              torch.Tensor(input_dims[0], input_dims[1])
          )
          nn.init.xavier_normal_(self.W)
          self.U = nn.Parameter(
              torch.Tensor(self.input_dims[0], self.input_dims[1])
          )
          nn.init.xavier_normal_(self.U)
          self.V = nn.Parameter(torch.Tensor(self.input_dims[1]))
          nn.init.normal_(self.V)
          self.b = nn.Parameter(torch.Tensor(self.input_dims[1]))
          nn.init.normal_(self.b)
      elif output == "scalar":
          self.W = nn.Parameter(torch.Tensor(input_dims[0]))
          nn.init.normal_(self.W)
          self.U = nn.Parameter(torch.Tensor(input_dims[0]))
          nn.init.normal_(self.U)
          self.V = nn.Parameter(torch.Tensor(1))
          nn.init.normal_(self.V)
          self.b = nn.Parameter(torch.Tensor(1))
          nn.init.normal_(self.b)
      self.flip = flip
      if grad_clip is not None:
          for p in self.parameters():
              p.register_hook(
                  lambda grad: torch.clamp(
                      grad, grad_clip[0], grad_clip[1]
                  )
              )
  
file_path: pykale/kale/embed/feature_fusion.py
imports: import torch
  from torch import nn
  from torch.autograd import Variable
label_desc: Use image node_id 1 to create a new BimodalInteractionFusion object from inherited base classes: nn with example: obj = BimodalInteractionFusion(input_dims, output_dim, output, flatten, clip, grad_clip, flip)