Skip to content

ctc_loss odds and ends#10112

Closed
t-vi wants to merge 3 commits intopytorch:masterfrom
t-vi:ctc_odds_and_ends
Closed

ctc_loss odds and ends#10112
t-vi wants to merge 3 commits intopytorch:masterfrom
t-vi:ctc_odds_and_ends

Conversation

@t-vi
Copy link
Collaborator

@t-vi t-vi commented Aug 1, 2018

  • Add convenience wrapper to pass tensors as input_lengths, target_lengths
  • Fix documentation example
  • Check BLANK >= 0

Thank you, Simon and Soumith for the suggestions!

- Add convenience wrapper to pass tensors as input_lengths,
target_lengths
- Fix documentation example
- Check BLANK >= 0

Thank you, Simon and Soumith for the suggestions
Copy link
Collaborator

@soumith soumith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add the allowed types for each input.

For example:

input_lengths: Tensor or tuple of size :math:`(N)`.

- func: ctc_loss(Tensor log_probs, Tensor targets, IntList input_lengths, IntList target_lengths, int64_t blank=0, int64_t reduction=Reduction::ElementwiseMean) -> Tensor
variants: function

- func: ctc_loss(Tensor log_probs, Tensor targets, Tensor input_lengths, Tensor target_lengths, int64_t blank=0, int64_t reduction=Reduction::ElementwiseMean) -> Tensor

This comment was marked as off-topic.

targets: Tensor of size :math:`(N, S)` or `(sum(target_lenghts))`.
Targets (cannot be blank). In the second form, the targets are assumed to be concatenated.
input_lengths: :math:`(N)`.
input_lengths: Tuple or tensor of size :math:`(N)`.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

>>> targets = torch.randint(1, 21, (16, 30), dtype=torch.long)
>>> input_lengths = torch.full((16,), 50, dtype=torch.long)
>>> target_lengths = torch.randint(10,30,(16,), dtype=torch.long)
>>> input_lengths = torch.full((16,), 50, dtype=torch.long).toarray()

This comment was marked as off-topic.

This comment was marked as off-topic.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SsnL is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Aug 3, 2018
Summary:
- Add convenience wrapper to pass tensors as input_lengths, target_lengths
- Fix documentation example
- Check BLANK >= 0

Thank you, Simon and Soumith for the suggestions!
Pull Request resolved: pytorch/pytorch#10112

Differential Revision: D9130737

Pulled By: SsnL

fbshipit-source-id: f9a0022a969788bda3db9f360e2564b519ebf2e6
goodlux pushed a commit to goodlux/pytorch that referenced this pull request Aug 15, 2018
Summary:
- Add convenience wrapper to pass tensors as input_lengths, target_lengths
- Fix documentation example
- Check BLANK >= 0

Thank you, Simon and Soumith for the suggestions!
Pull Request resolved: pytorch#10112

Differential Revision: D9130737

Pulled By: SsnL

fbshipit-source-id: f9a0022a969788bda3db9f360e2564b519ebf2e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants