Method 썸네일형 리스트형 [Remark] Power method의 원리와 python 코드 구현 Power method의 원리와 코드 구현 Pytorch로 구현한 Power method 는 다음과 같습니다. import torch import numpy as np def power_method(weight, power_iteration=1): # --- variables dim_in, dim_out = weight.size(1), weight.size(0) u = torch.rand(dim_out) v = torch.rand(dim_in) # --- iteration for i in range(power_iteration): u = torch.matmul(weight, v) / torch.matmul(weight, v).norm() v = torch.matmul(weight.T, u) / torch.. 더보기 이전 1 다음