当前位置:网站首页>Norm normalization in tensorflow and pytorch of records

Norm normalization in tensorflow and pytorch of records

2022-04-23 20:48:00 NuerNuer

Recently, in the tensorflow Translate into torch There was a problem , There is a function tf.nn.l2_normalize No corresponding replacement function found , But I wrote such an operation myself , Recently, I've been reading to make a torch Source code found , Just record it in time

tf:

import tensorflow as tf

tf.nn.l2_normalize(x, dim, epsilon=1e-12, name=None)

Parameters :
x: Input ; 
dim: by l2 Normalized dimension
epsilon: Normalized minimum boundary

torch:

import torch.nn.functional as F

F.normalize(input, p=2, dim=1, eps=1e-12, out=None)

Parameters :
input: Input
p: Norm type
dim: dimension
eps: Normalized minimum boundary

版权声明
本文为[NuerNuer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210545522616.html