๋ถ๋ฆ
triplet_loss = nn.TripletMarginLoss()
๊ฒฐ๊ณผ:
AttributeError: module 'torch.nn' has no attribute 'TripletMarginLoss'
์๋
import torch.nn as nn
TripletMarginLoss๋ฅผ ์ถ๊ฐํ ๊ด๋ จ PR: #1165
ํ์ฌ ํด๊ฒฐ ๋ฐฉ๋ฒ์ F.triplet_margin_loss
์ง์ ์ฌ์ฉํ๋ ๊ฒ์
๋๋ค. ์ฌ๊ธฐ์ F
๋ import torch.nn.functional as F
์
๋๋ค.
๋ ๋ค๋ฅธ ํด๊ฒฐ ๋ฐฉ๋ฒ์ from torch.nn.modules.loss import TripletMarginLoss
๋ฅผ ์ถ๊ฐํ๋ ๊ฒ์
๋๋ค.
๋ง์คํฐ์์ ๊ณ ์ . ๋ค์ ๋ฆด๋ฆฌ์ค์ ์์ต๋๋ค.
์๋
ํ์ธ์, m = nn.Upsample(scale_factor=2, mode='bilinear')
ํธ์ถํ ๋๋ ๋น์ทํ ์ผ์ด ๋ฐ์ํฉ๋๋ค.
AttributeError: 'module' ๊ฐ์ฒด์ 'Upsample' ์์ฑ์ด ์์ต๋๋ค.
ํ์ง๋ง nn.UpsamplingBilinear2d
์ฑ๊ณต์ ์ผ๋ก ํธ์ถํ ์ ์์ต๋๋ค.
๊ฒ๋ค๊ฐ Cubic Upsample
๋ฅผ ๊ตฌํํ ๊ณํ์ด ์๋์~
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์๋ ํ์ธ์,
m = nn.Upsample(scale_factor=2, mode='bilinear')
ํธ์ถํ ๋๋ ๋น์ทํ ์ผ์ด ๋ฐ์ํฉ๋๋ค.AttributeError: 'module' ๊ฐ์ฒด์ 'Upsample' ์์ฑ์ด ์์ต๋๋ค.
ํ์ง๋ง
nn.UpsamplingBilinear2d
์ฑ๊ณต์ ์ผ๋ก ํธ์ถํ ์ ์์ต๋๋ค.๊ฒ๋ค๊ฐ
Cubic Upsample
๋ฅผ ๊ตฌํํ ๊ณํ์ด ์๋์~