class_docstr: Bi-linear decoder
  BiDecoder takes pairs of node embeddings and predicts respective entries in the adjacency matrix.
class_docstr_tok: ["Bi-linear","decoder","BiDecoder","takes","pairs","of","node","embeddings","and","predicts","respective","entries","in","the","adjacency","matrix","."]
code: def forward(self, u_inputs, i_inputs, users, items=None):
      u_inputs = self.dropout(u_inputs)
      i_inputs = self.dropout(i_inputs)
  
      if items is not None:
          users_emb = u_inputs[users]
          items_emb = i_inputs[items]
  
          basis_outputs = []
          for i in range(self.num_weights):
              users_emb_temp = torch.mm(users_emb, self.weights[i])
              scores = torch.mul(users_emb_temp, items_emb)
              scores = torch.sum(scores, dim=1)
              basis_outputs.append(scores)
      else:
          users_emb = u_inputs[users]
          items_emb = i_inputs
  
          basis_outputs = []
          for i in range(self.num_weights):
              users_emb_temp = torch.mm(users_emb, self.weights[i])
              scores = torch.mm(
                  users_emb_temp, items_emb.transpose(0, 1)
              )
              basis_outputs.append(scores.view(-1))
  
      basis_outputs = torch.stack(basis_outputs, dim=1)
      basis_outputs = self.dense_layer(basis_outputs)
      output = self.activate(basis_outputs)
  
      return output
  
imports: import math
  import numpy
  import scipy.sparse
  import torch
  import torch.nn
  from recbole.model.abstract_recommender import GeneralRecommender
  from recbole.model.layers import SparseDropout
  from recbole.utils import InputType
label_desc: Use image node_id 3 for calling the BiDecoder obj's underlying member method code with example usage: obj.forward(u_inputs, i_inputs, users, items) and returns: output