Commit 5076a5da authored by Shashwath H A's avatar Shashwath H A
Browse files

Fix proj adp softmax output return when n_clusters=0

parent b3f9e945
...@@ -114,10 +114,10 @@ class ProjectedAdaptiveLogSoftmax(nn.Module): ...@@ -114,10 +114,10 @@ class ProjectedAdaptiveLogSoftmax(nn.Module):
logit = self._compute_logit(hidden, self.out_layers[0].weight, logit = self._compute_logit(hidden, self.out_layers[0].weight,
self.out_layers[0].bias, self.out_projs[0]) self.out_layers[0].bias, self.out_projs[0])
if target is not None: if target is not None:
output = -F.log_softmax(logit, dim=-1) \ out = -F.log_softmax(logit, dim=-1) \
.gather(1, target.unsqueeze(1)).squeeze(1) .gather(1, target.unsqueeze(1)).squeeze(1)
else: else:
output = F.log_softmax(logit, dim=-1) out = F.log_softmax(logit, dim=-1)
else: else:
# construct weights and biases # construct weights and biases
weights, biases = [], [] weights, biases = [], []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment