목록pytorch module 정리 (5)
yuns
https://pytorch.org/에 접속 자신에게 맞는 버전을 클릭 하면 command창이 뜬다! conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
pytorch.org/docs/stable/generated/torch.nn.MultiLabelSoftMarginLoss.html multi-label일 때 torch에서 지원하는 loss가 있다. class torch.nn.MultiLabelSoftMarginLoss(weight=None, size_average=None, reduce=None, reduction='mean') [input] weight(type: Tensor) - 각 클래스의 가중치(a manual rescaling weight given to each class) size_average(type: bool) 각 손실 요소에 대하여 평균화 By default, the losses are averaged over each loss el..
n x n matrix에서 대각행렬에 해당하는 부분을 반환해줌 1 x n차원으로 반환해줌
import torch.nn.functional as F F.log_softmax(): log + softmax Softmax함수 z = torch.FloatTensor([[1,2,3], [1,2,3]]) float tensor로 설정 후 1) dim = 0: column 기준 y = F.softmax(z, dim=0) --> tensor([[0.5000, 0.5000, 0.5000], [0.5000, 0.5000, 0.5000]]) 2) dim = 1: row 기준 y = F.softmax(z, dim=1) --> tensor([[0.0900, 0.2447, 0.6652], [0.0900, 0.2447, 0.6652]]) 합이 1이 되도록.. log_softmax = log(softmax)함수 http..
pytorch.org/vision/stable/datasets.html torchvision.datasets — Torchvision master documentation torchvision.datasets All datasets are subclasses of torch.utils.data.Dataset i.e, they have __getitem__ and __len__ methods implemented. Hence, they can all be passed to a torch.utils.data.DataLoader which can load multiple samples in parallel using torch. pytorch.org img_data = torchvision.datasets.I..