class_docstr: Deep & Cross Network replaces the wide part in Wide&Deep with cross network,
  automatically construct limited high-degree cross features, and learns the corresponding weights.
class_docstr_tok: ["Deep","&","Cross","Network","replaces","the","wide","part","in","Wide","&","Deep","with","cross","network",",","automatically","construct","limited","high-degree","cross","features",",","and","learns","the","corresponding","weights","."]
docstr: Cross network is composed of cross layers, with each layer having the following formula.
  
  .. math:: x_{l+1} = x_0 {x_l^T} w_l + b_l + x_l
  
  :math:`x_l`, :math:`x_{l+1}` are column vectors denoting the outputs from the l -th and
  (l + 1)-th cross layers, respectively.
  :math:`w_l`, :math:`b_l` are the weight and bias parameters of the l -th layer.
  
  Args:
      x_0(torch.Tensor): Embedding vectors of all features, input of cross network.
  
  Returns:
      torch.Tensor:output of cross network, [batch_size, num_feature_field * embedding_size]
docstr_tok: ["Cross","network","is","composed","of","cross","layers",",","with","each","layer","having","the","following","formula",".","..","math",":",":","x_","{","l+1","}","=","x_0","{","x_l^T","}","w_l","+","b_l","+","x_l",":","math",":","`","x_l","`",",",":","math",":","`","x_","{","l+1","}","`","are","column","vectors","denoting","the","outputs","from","the","l","-th","and","(","l","+","1",")","-th","cross","layers",",","respectively",".",":","math",":","`","w_l","`",",",":","math",":","`","b_l","`","are","the","weight","and","bias","parameters","of","the","l","-th","layer",".","Args",":","x_0","(","torch.Tensor",")",":","Embedding","vectors","of","all","features",",","input","of","cross","network",".","Returns",":","torch.Tensor",":","output","of","cross","network",",","[","batch_size",",","num_feature_field","*","embedding_size","]"]
code: def cross_network(self, x_0):
      r"""Cross network is composed of cross layers, with each layer having the following formula.
  
      .. math:: x_{l+1} = x_0 {x_l^T} w_l + b_l + x_l
  
      :math:`x_l`, :math:`x_{l+1}` are column vectors denoting the outputs from the l -th and
      (l + 1)-th cross layers, respectively.
      :math:`w_l`, :math:`b_l` are the weight and bias parameters of the l -th layer.
  
      Args:
          x_0(torch.Tensor): Embedding vectors of all features, input of cross network.
  
      Returns:
          torch.Tensor:output of cross network, [batch_size, num_feature_field * embedding_size]
  
      """
      x_l = x_0
      for i in range(self.cross_layer_num):
          xl_w = torch.tensordot(
              x_l, self.cross_layer_w[i], dims=([1], [0])
          )
          xl_dot = (x_0.transpose(0, 1) * xl_w).transpose(0, 1)
          x_l = xl_dot + self.cross_layer_b[i] + x_l
      return x_l
  
file_path: RecBole/recbole/model/context_aware_recommender/dcn.py
imports: import torch
  import torch.nn
  from torch.nn.init import xavier_normal_, constant_
  from recbole.model.abstract_recommender import ContextRecommender
  from recbole.model.layers import MLPLayers
  from recbole.model.loss import RegLoss
label_desc: Use image node_id 3 for calling the DCN obj's underlying member method code with example usage: obj.cross_network(x_0) and returns: x_l