728x90 반응형 SMALL no_grad()1 [PyTorch] gradient 시각화 gradient 시각화.import torchx = torch.FloatTensor(2, 2)y = torch.FloatTensor(2, 2)y.requires_grad_(True) # 향후 gradient를 계산하기 위해 이 tensor가 포함된 모든 연산을 추적(track)한다z = ( x + y ) + torch.Tensor(2, 2)print(z)tensor([[2.5832e+30, 2.7510e+36], [9.7644e+21, 5.9766e+31]], grad_fn=)x = torch.FloatTensor(2, 2)y = torch.FloatTensor(2, 2)y.requires_grad_(True)with torch.no_grad(): # 이 연산은 추적하지 않음 z = (.. 2023. 3. 9. 이전 1 다음 728x90 반응형 LIST