Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'torch.nn' has no attribute 'TripletMarginLoss' #1224

Closed
bartolsthoorn opened this issue Apr 10, 2017 · 3 comments
Closed

'torch.nn' has no attribute 'TripletMarginLoss' #1224

bartolsthoorn opened this issue Apr 10, 2017 · 3 comments
Assignees

Comments

@bartolsthoorn
Copy link
Contributor

bartolsthoorn commented Apr 10, 2017

Calling

triplet_loss = nn.TripletMarginLoss()

results in:

AttributeError: module 'torch.nn' has no attribute 'TripletMarginLoss'

even with

import torch.nn as nn

Related PR that added introduced TripletMarginLoss: #1165

Work-around for now is to use F.triplet_margin_loss directly, where F is import torch.nn.functional as F.

@apaszke
Copy link
Contributor

apaszke commented Apr 10, 2017

Another workaround would be to add from torch.nn.modules.loss import TripletMarginLoss.

@soumith
Copy link
Member

soumith commented Apr 11, 2017

fixed in master. will be in next release.

@soumith soumith closed this as completed Apr 11, 2017
@D-X-Y
Copy link

D-X-Y commented Jun 22, 2017

Hi, similar thing happens when I call m = nn.Upsample(scale_factor=2, mode='bilinear')
AttributeError: 'module' object has no attribute 'Upsample'
But I can successfully call nn.UpsamplingBilinear2d.
Besides, is there any plan to implement the Cubic Upsample~

jjsjann123 pushed a commit to jjsjann123/pytorch that referenced this issue Nov 5, 2021
* Support TensorIndex outputs of kir::Expr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants