Skip to content

Commit

Permalink
Doc: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
speedcell4 committed Jul 30, 2021
1 parent ff118f7 commit 89d40d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

```python
import torch
from torch.nn.utils.rnn import pack_sequence
from torchrua import pack_sequence

from torchlatent.crf import CrfDecoder

Expand All @@ -30,13 +30,13 @@ emissions = pack_sequence([
torch.randn((5, num_conjugates, num_tags), requires_grad=True),
torch.randn((2, num_conjugates, num_tags), requires_grad=True),
torch.randn((3, num_conjugates, num_tags), requires_grad=True),
], enforce_sorted=False)
])

tags = pack_sequence([
torch.randint(0, num_tags, (5, num_conjugates)),
torch.randint(0, num_tags, (2, num_conjugates)),
torch.randint(0, num_tags, (3, num_conjugates)),
], enforce_sorted=False)
])

print(decoder.fit(emissions=emissions, tags=tags))
# tensor([[-6.7424],
Expand All @@ -53,7 +53,7 @@ print(decoder.decode(emissions=emissions))
# [2],
# [0],
# [1],
# [2]]),
# [2]]),
# batch_sizes=tensor([3, 3, 2, 1, 1]),
# sorted_indices=tensor([0, 2, 1]),
# unsorted_indices=tensor([0, 2, 1]))
Expand Down

0 comments on commit 89d40d3

Please sign in to comment.