Skip to content

Zero length sequences panic with a message about cat #27

Description

@CanReader
LSTM::new(2, 3).forward(&Tensor::zeros(&[1, 0, 2]));
// panicked at view.rs:129: cat: needs at least one tensor

stack_steps (src/nn/rnn.rs:192) hands an empty slice to Tensor::stack, which
goes to Tensor::cat, which rejects it. Tensor::stack(&[], 0) gives the same
message directly.

Both are reachable from a padded batch where one sequence has length 0, and the
message points at completely the wrong place.

Reject an empty sequence in check_sequence with a message naming the layer, and
give stack its own assert.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Hygienearea:nnbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions