Pytorch: 'torch.nn' hat kein Attribut 'TripletMarginLoss'

Erstellt am 10. Apr. 2017  ·  3Kommentare  ·  Quelle: pytorch/pytorch

Berufung

triplet_loss = nn.TripletMarginLoss()

ergibt:

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

sogar mit

import torch.nn as nn

Verwandte PR, die TripletMarginLoss hinzugefügt haben: #1165

Die Umgehung für den Moment besteht darin, F.triplet_margin_loss direkt zu verwenden, wobei F import torch.nn.functional as F .

high priority

Hilfreichster Kommentar

Hallo, Ähnliches passiert, wenn ich m = nn.Upsample(scale_factor=2, mode='bilinear')
AttributeError: 'module'-Objekt hat kein Attribut 'Upsample'
Aber ich kann erfolgreich nn.UpsamplingBilinear2d anrufen.
Gibt es außerdem einen Plan, die Cubic Upsample ~

Alle 3 Kommentare

Eine andere Problemumgehung wäre das Hinzufügen von from torch.nn.modules.loss import TripletMarginLoss .

im Meister fixiert. wird in der nächsten Ausgabe sein.

Hallo, Ähnliches passiert, wenn ich m = nn.Upsample(scale_factor=2, mode='bilinear')
AttributeError: 'module'-Objekt hat kein Attribut 'Upsample'
Aber ich kann erfolgreich nn.UpsamplingBilinear2d anrufen.
Gibt es außerdem einen Plan, die Cubic Upsample ~

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen