Single return value for a sequence LSTM/RNN

34 views
Skip to first unread message

Tiago Trojahn

unread,
Sep 23, 2016, 2:42:13 PM9/23/16
to torch7
I'm trying to build a LSTM/RNN which receives a variable-size sequence and returns a single class number for that sequence (it's a binary problem). Seemed trivial but for a week now i'm struggling with it.


A similar question points to this repo (https://github.com/stanfordnlp/treelstm), but the code within seemed too complex for a one-week-torch-experience...

Other topic sugested to use a Sum()/Max() as a last layer to do it. I can forward it, but i simply cannot grasp how to define a criterion for training it. For example:

nn.SequencerCriterion(nn.ClassNLLCriterion()) --> Does not work when the sequence size is larger than 1. target should have as many elements as input (WHY!?!?)

nn.SequencerCriterion(nn.MSECriterion()) --> Does not work. attempt to index local 'target' (a number value)

I did not used MaskZero/MaskZeroCriterion simply because i'm passing a single sequence each step (batchSize = 1)...


How can I solve such problem?

Mehmet Sarıgül

unread,
Oct 21, 2016, 4:14:27 AM10/21/16
to torch7
I have the same issue. "attempt to index local 'target' (a number value)" for one output. Did you get any solution.

23 Eylül 2016 Cuma 21:42:13 UTC+3 tarihinde Tiago Trojahn yazdı:
Reply all
Reply to author
Forward
0 new messages