class_docstr: DCNV2 improves the cross network by extending the original weight vector to a matrix,
  significantly improves the expressiveness of DCN. It also introduces the MoE and
  low rank techniques to reduce time cost.
class_docstr_tok: ["DCNV2","improves","the","cross","network","by","extending","the","original","weight","vector","to","a","matrix",",","significantly","improves","the","expressiveness","of","DCN",".","It","also","introduces","the","MoE","and","low","rank","techniques","to","reduce","time","cost","."]
code: def forward(self, interaction):
      dcn_all_embeddings = self.concat_embed_input_fields(
          interaction
      )  # (batch_size, num_field, embed_dim)
      batch_size = dcn_all_embeddings.shape[0]
      dcn_all_embeddings = dcn_all_embeddings.view(
          batch_size, -1
      )  # (batch_size, in_feature_num)
  
      if self.structure == "parallel":
          deep_output = self.mlp_layers(
              dcn_all_embeddings
          )  # (batch_size, mlp_hidden_size)
          if self.mixed:
              cross_output = self.cross_network_mix(
                  dcn_all_embeddings
              )  # (batch_size, in_feature_num)
          else:
              cross_output = self.cross_network(dcn_all_embeddings)
          concat_output = torch.cat(
              [cross_output, deep_output], dim=-1
          )  # (batch_size, in_num + mlp_size)
          output = self.sigmoid(self.predict_layer(concat_output))
  
          return output.squeeze(dim=1)
  
      elif self.structure == "stacked":
          if self.mixed:
              cross_output = self.cross_network_mix(
                  dcn_all_embeddings
              )  # (batch_size, in_feature_num)
          else:
              cross_output = self.cross_network(dcn_all_embeddings)
          deep_output = self.mlp_layers(
              cross_output
          )  # (batch_size, mlp_hidden_size)
          output = self.sigmoid(self.predict_layer(deep_output))
  
          return output.squeeze(dim=1)
  
file_path: RecBole/recbole/model/context_aware_recommender/dcnv2.py
imports: import torch
  import torch.nn
  from recbole.model.abstract_recommender import ContextRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.layers import MLPLayers
  from recbole.model.loss import RegLoss
label_desc: Use image node_id 4 for calling the DCNV2 obj's underlying member method code with example usage: obj.forward(interaction) and returns: output, output