class_docstr: A bilinear module that deals with broadcasting for efficient memory usage.
  Input: tensors of sizes (N x L1 x D1) and (N x L2 x D2)
  Output: tensor of size (N x L1 x L2 x O)
class_docstr_tok: ["A","bilinear","module","that","deals","with","broadcasting","for","efficient","memory","usage",".","Input",":","tensors","of","sizes","(","N","x","L1","x","D1",")","and","(","N","x","L2","x","D2",")","Output",":","tensor","of","size","(","N","x","L1","x","L2","x","O",")"]
code: def forward(self, input1, input2):
      input1_size = list(input1.size())
      input2_size = list(input2.size())
      output_size = [
          input1_size[0],
          input1_size[1],
          input2_size[1],
          self.output_size,
      ]
  
      # ((N x L1) x D1) * (D1 x (D2 x O)) -> (N x L1) x (D2 x O)
      intermediate = torch.mm(
          input1.view(-1, input1_size[-1]),
          self.weight.view(-1, self.input2_size * self.output_size),
      )
      # (N x L2 x D2) -> (N x D2 x L2)
      input2 = input2.transpose(1, 2)
      # (N x (L1 x O) x D2) * (N x D2 x L2) -> (N x (L1 x O) x L2)
      output = intermediate.view(
          input1_size[0],
          input1_size[1] * self.output_size,
          input2_size[2],
      ).bmm(input2)
      # (N x (L1 x O) x L2) -> (N x L1 x L2 x O)
      output = output.view(
          input1_size[0],
          input1_size[1],
          self.output_size,
          input2_size[1],
      ).transpose(2, 3)
  
      return output
  
file_path: stanza/stanza/models/common/biaffine.py
imports: import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the PairwiseBilinear obj's underlying member method code with example usage: obj.forward(input1, input2) and returns: output