self.users = nn.Embedding( n_users, dim, max_norm=1 )

  self.users = nn.Embedding( n_users, dim, max_norm=1 )

请问一下各位大佬,我看到一段代码中max_norm=1我查了他说最大范数为1,这个是什么意思,为什么嵌入向量范数超过界限,就要归一化。
# 随机初始化用户的向量,

    self.users = nn.Embedding( n_users, dim, max_norm=1 )

max_norm (python:float, optional) – 最大范数,如果嵌入向量的范数超过了这个界限,就要进行再归一化。
还有这个,假设指定n_users,那么指定的这个dim=10,就是一个10维的用户,那么为什么这个要一个维数的概念,不同维数有区别吗


回答:

nn.Embedding

embedding_dim (int) – the size of each embedding vector
max_norm (float, optional) – If given, each embedding vector with norm larger than max_norm is renormalized to have norm max_norm.

Embedding 是把一个数映射到一个向量。embedding_dim 是这个向量的维度。max_norm 指定了向量的最大允许的 norm 。

以上是 self.users = nn.Embedding( n_users, dim, max_norm=1 ) 的全部内容, 来源链接: utcz.com/p/938448.html

回到顶部