pytorch

    [Pytorch] 모델 구조 확인, parameter확인

    모델 구조(architecture) 확인하기 model = models.resnet50(pretrained = True) print(model) 모델 파라미터(parameter) 확인하기 - parameters() for name, param in model.named_parameters(): count+=1 if count==1: print(param.size()) print(name) torch.Size([64]) conv1.1.weight 모델 파라미터(parameter) 확인하기 - children() for child in model.children(): count += 1 if count == 2: print(child) children()에서 name변수를 이용하면 현재 parameter(l..

    [Pytorch] model.train(), model.eval() 의미

    https://stackoverflow.com/questions/60018578/what-does-model-eval-do-in-pytorch/60018731#60018731 What does model.eval() do in pytorch? I am using this code, and saw model.eval() in some cases. I understand it is supposed to allow me to "evaluate my model", but I don't understand when I should and shouldn't use it, or how... stackoverflow.com nn.Module에는 train time과 evaluate time에 수행하는 다른 작업을 sw..

    [Pytorch] torch.manual_seed()

    random seed 란 ? numpy 에서도 사용했던 random seed 5개의 난수를 생성 한다고 하면 우리는 np.random.rand(5)로 난수를 생성한다. 연달아서 np.random.rand(5)를 실행한다면 아래처럼, 생성할때마다 매번 서로 다른 5개의 숫자를 생성할 것이다. random seed를 고정한다는 말은 동일한 셋트의 난수를 생성할 수 있게 하는 것이다. seed() 괄호 안에 들어가는 숫자는 무슨 의미일까? seed value 숫자 자체는 중요하지 않고 서로 다른 시드를 사용하면 서로 다른 난수를 생성한다는 점만 알면 된다. pytorch random seed deep learning에서 random num을 사용하는 경우가 많다. (초기화를 할 때 주로 씀) random nu..