I am learning to implement the Factorization Machine in Pytorch. And there should be some feature crossing operations. For example, I’ve got three features [A,B,C], after embedding, they are [vA,vB,vC], so the feature crossing is “[vA·vB], [vA·vC], [vB·vc]”.
I know this operation can be simplified by the following:
It can be implemented by MATRIX OPERATIONS. But this only gives a final result, say, a single value.
The question is, how to get all cross_vec in the following without doing FOR loop: