Skip to content

Commit 1dbf44c

Browse files
apaszkesoumith
authored andcommitted
Add SmoothL1Loss to functional
1 parent 1259a06 commit 1dbf44c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

torch/nn/functional.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,11 @@ def cross_entropy(input, target, weight=None, size_average=True):
496496
def binary_cross_entropy(input, target, weight=None, size_average=True):
497497
return _functions.thnn.BCELoss(size_average, weight=weight)(input, target)
498498

499+
500+
def smooth_l1_loss(input, target, size_average=True):
501+
return _functions.thnn.SmoothL1Loss(size_average)(input, target)
502+
503+
499504
def pixel_shuffle(input, upscale_factor):
500505
"""Rearranges elements in a tensor of shape [*, C*r^2, H, W] to a
501506
tensor of shape [C, H*r, W*r]. This is useful for implementing

0 commit comments

Comments
 (0)