dqs.torch.layer.HierarchicalSoftmax
HierarchicalSoftmax layer for PyTorch.
class HierarchicalSoftmax()
Tensor Shape
I/O |
Shape |
---|---|
Input |
(N, M) |
Output |
(N, M) |
N corresponds the batch size.
Example
The following code transforms input tensor x into output tensor y of the same size.
sizes = torch.tensor([4,4], dtype=torch.long)
l = HierarchicalSoftmax()
x = torch.randn(128, 10)
y = l(x)