Y(i)=X(i)/||X(i)||2。
e.g.
X =
1 2 3 4
5 6 7 8
X_norm = sqrt( sum(X.^2,1) );
Y = bsxfun(@rdivide, X, X_norm);
--->
X_norm =
5.0990 6.3246 7.6158 8.9443
Y =
0.1961 0.3162 0.3939 0.4472
0.9806 0.9487 0.9191 0.8944
本文共 272 字,大约阅读时间需要 1 分钟。
Y(i)=X(i)/||X(i)||2。
e.g.
X =
1 2 3 4
5 6 7 8
X_norm = sqrt( sum(X.^2,1) );
Y = bsxfun(@rdivide, X, X_norm);
--->
X_norm =
5.0990 6.3246 7.6158 8.9443
Y =
0.1961 0.3162 0.3939 0.4472
0.9806 0.9487 0.9191 0.8944
转载于:https://www.cnblogs.com/deeplearning2015/p/4984155.html