Deep Learning study

[Pytorch] torch.nn.Upsample 본문

AI/Pytorch api

[Pytorch] torch.nn.Upsample

HwaniL.choi 2018. 4. 1. 19:35
반응형
class torch.nn.Upsample(size=Nonescale_factor=Nonemode='nearest')[source]

  • input은 minibatch * channels * depth * height * width 이다, 하지만 2D에서는 4D Tensor만 있으면 된다. 


    Size와 scale_factor는 같이 사용하면 의미가 명확하지 않기 때문에, 같이사용하지 않는다.



    size(tuple, optional) : output사이즈를 직접 설정해 준다. (Depth, Height, Width)


    scale_factor(int, optional) : Depth, Height, Width에 입력받은 정수 만큼 곱해준다. (1,1,2,2) 가 인풋으로 들어오면 (1,1,4,4)가 된다.


    mode(string, optional) : 어떤 알고리즘을 사용할 것인지 명시해준다. nearest | linear | bilinear | trilinear 중 default 는 nearest이다.




    원문보러가기





    grayscale 이미지를 RGB 칼라 이미지로 변환하는 모델을 만들려고 하는도중 찾았다. 아직 하는중이지만, 이렇게라도 남겨두면 다시 찾아볼때 편할것 같다.

    반응형

    'AI > Pytorch api' 카테고리의 다른 글

    [Pytorch]torch.nn.functoinal.pad()  (2) 2020.12.29
    [Pytorch] torch.Tensor.view  (0) 2018.05.23
    [Pytorch] torch.nn.Sequential  (0) 2018.04.02
    [Pytorch] torch.nn.Conv2d  (0) 2018.04.01
    Comments