张量的谱范数

时间:2018-05-05 19:29:14

标签: numpy image-processing multidimensional-array tensor norm

我想创建一个幅度范数小于或等于1的张量。我写了一些代码来做到这一点,但我不确定这是否真的正确,因为我不确定numpy的L2范数是否实际上计算了频谱范数。我的代码:

def make_tensor(shape):
Y = np.zeros(shape)
mat = []
for i in range(3):
    matrix = np.random.random_integers(0, 255, (shape[0], shape[1]))
    matrix = matrix/(LA.norm(matrix,2)+np.random.randint(0,255))
    mat.append(matrix)
    Y[:, :, i] = mat[i]
return Y

Y是张量的,其谱范数小于或等于1吗?

0 个答案:

没有答案