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维的用户,那么为什么这个要一个维数的概念,不同维数有区别吗

阅读 2.4k
1 个回答

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 。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题