|View source on GitHub|
Dot interaction layer.
tfrs.layers.feature_interaction.DotInteraction( self_interaction: bool = False, skip_gather: bool = False, name: Optional[str] = None, **kwargs ) -> None
See theory in the DLRM paper: https://arxiv.org/pdf/1906.00091.pdf, section 2.1.3. Sparse activations and dense activations are combined. Dot interaction is applied to a batch of input Tensors [e1,...,e_k] of the same dimension and the output is a batch of Tensors with all distinct pairwise dot products of the form dot(e_i, e_j) for i <= j if self self_interaction is True, otherwise dot(e_i, e_j) i < j.
||Boolean indicating if features should self-interact. If it is True, then the diagonal enteries of the interaction matric are also taken.|
||An optimization flag. If it's set then the upper triangle part of the dot interaction matrix dot(e_i, e_j) is set to 0. The resulting activations will be of dimension [num_features * num_features] from which half will be zeros. Otherwise activations will be only lower triangle part of the interaction matrix. The later saves space but is much slower.|
||String name of the layer.|
call( inputs: List[tf.Tensor] ) -> tf.Tensor
Performs the interaction operation on the tensors in the list.
The tensors represent as transformed dense features and embedded categorical features. Pre-condition: The tensors should all have the same shape.
||List of features with shapes [batch_size, feature_dim].|
Tensor representing interacted features. It has a dimension