'z' is the output of LSTM, and 'label' is the output reference. error = C.minus(label, z)
I want to compute the sum of 'error' across the sequence axis, but when I ran the following command,
C.sequence.reduce_sum(error).eval(mb_data)
I got the following errors:
Traceback (most recent call last):
File "", line 1, in
File "/anaconda2/envs/cntk/lib/python2.7/site-packages/cntk/ops/functions.py", line 626, in eval
_, output_map = self.forward(arguments, outputs, device=device, as_numpy=as_numpy)
File "/anaconda2/envs/cntk/lib/python2.7/site-packages/cntk/internal/swig_helper.py", line 69, in wrapper
result = f(*args, **kwds)
File "/anaconda2/envs/cntk/lib/python2.7/site-packages/cntk/ops/functions.py", line 760, in forward
keep_for_backward)
File "/anaconda2/envs/cntk/lib/python2.7/site-packages/cntk/cntk_py.py", line 1568, in _forward
return _cntk_py.Function__forward(self, *args)
RuntimeError: Node 'UnpackSequenceOp8315' (UnpackSequence operation): N9Microsoft3MSR4CNTK18UnpackSequenceNodeIfEE node cannot perform sequence axis reduction for truncated sequence.
Can you help me?
It seems your input has truncated sequences, thus sequence.reduce_sum does not work. You may run a slower version using Fold: C.layers.Fold(C.plus)(error)
Thanks, KeDengMS.
My input is truncated sequences. Let tmp = C.layers.Fold(C.plus)(error)
then error
Composite(Minus): Input('Input4', [#, *], [257]), Input('Input3', [#, *], [1799]) -> Output('Minus1331_Output_0', [#, *], [257])
tmp
Composite(Combine): Input('Input4', [#, *], [257]), Input('Input3', [#, *], [1799]) -> Output('Block1466_Output_0', [#], [257])
when I run tmp.eval(mb_data), I got the errors,
Traceback (most recent call last):
File "", line 1, in
File "/anaconda2/envs/cntk/lib/python2.7/site-packages/cntk/ops/functions.py", line 626, in eval
_, output_map = self.forward(arguments, outputs, device=device, as_numpy=as_numpy)
File "/anaconda2/envs/cntk/lib/python2.7/site-packages/cntk/internal/swig_helper.py", line 69, in wrapper
result = f(*args, **kwds)
File "/anaconda2/envs/cntk/lib/python2.7/site-packages/cntk/ops/functions.py", line 760, in forward
keep_for_backward)
File "/anaconda2/envs/cntk/lib/python2.7/site-packages/cntk/cntk_py.py", line 1568, in _forward
return _cntk_py.Function__forward(self, *args)
RuntimeError: The delay node tries to access future values that are out of bound, possibly because there is no sentence end marker in the MBLayout.
mb_data
{Input('Input3', [#, *], [1799]): MinibatchData(data=Value([16 x 16 x 1799], GPU), samples=256, seqs=16), Input('Input4', [#, *], [257]): MinibatchData(data=Value([16 x 16 x 257], GPU), samples=256, seqs=16)}
So how can I get the evaluation of tmp function when given minibatch data?