Personalized Ranking for Recommender Systems

https://d2l.ai/chapter_recommender-systems/ranking.html

BPRLoss is a scalar or vector?

It is a vector. The summing dimension is kept here for the convience of computation. You can actually think it as a scalar.