summaryrefslogtreecommitdiff
path: root/torch/legacy/nn/DistKLDivCriterion.py
diff options
context:
space:
mode:
authorChristian Puhrsch <cpuhrsch@fb.com>2018-09-20 13:57:22 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-09-20 14:00:54 -0700
commitd8f6be686d419330476e7c3318e264f978765626 (patch)
treea60f1a9440ecbe7e341b0cfb4eb1c9bf9b0fb952 /torch/legacy/nn/DistKLDivCriterion.py
parent24ec8139673b30204c23c3ea1c8d72ffe589df07 (diff)
downloadpytorch-d8f6be686d419330476e7c3318e264f978765626.tar.gz
pytorch-d8f6be686d419330476e7c3318e264f978765626.tar.bz2
pytorch-d8f6be686d419330476e7c3318e264f978765626.zip
Remove torch/legacy (#11823)
Summary: Largely unused and hinders current development Pull Request resolved: https://github.com/pytorch/pytorch/pull/11823 Differential Revision: D9925094 Pulled By: cpuhrsch fbshipit-source-id: c797f62180e2128f9a567b0c57c8347957470ea5
Diffstat (limited to 'torch/legacy/nn/DistKLDivCriterion.py')
-rw-r--r--torch/legacy/nn/DistKLDivCriterion.py38
1 files changed, 0 insertions, 38 deletions
diff --git a/torch/legacy/nn/DistKLDivCriterion.py b/torch/legacy/nn/DistKLDivCriterion.py
deleted file mode 100644
index 5aa175604a..0000000000
--- a/torch/legacy/nn/DistKLDivCriterion.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import torch
-from torch.nn.functional import _Reduction
-from .Criterion import Criterion
-
-
-class DistKLDivCriterion(Criterion):
-
- def __init__(self, sizeAverage=True):
- super(DistKLDivCriterion, self).__init__()
- self.sizeAverage = sizeAverage
- self.output_tensor = torch.Tensor(1)
-
- def updateOutput(self, input, target):
- assert input.is_same_size(target)
- if self.output_tensor is None:
- self.output_tensor = input.new(1)
- self._backend.DistKLDivCriterion_updateOutput(
- self._backend.library_state,
- input,
- target,
- self.output_tensor,
- _Reduction.legacy_get_enum(self.sizeAverage, True, emit_warning=False),
- )
- self.output = self.output_tensor[0].item()
- return self.output
-
- def updateGradInput(self, input, target):
- assert input.is_same_size(target)
- implicit_gradOutput = torch.ones(1).type_as(input)
- self._backend.DistKLDivCriterion_updateGradInput(
- self._backend.library_state,
- input,
- target,
- implicit_gradOutput,
- self.gradInput,
- _Reduction.legacy_get_enum(self.sizeAverage, True, emit_warning=False),
- )
- return self.gradInput