I am trying to implement LSTM in CNTK (using Python) to classify a sequence.
Input:
Net:
input = input_variable(input_dim) label = input_variable(num_output_classes) h = Recurrence(LSTM(lstm_dim)) (input) final_output = C.sequence.last(h) z = Dense(num_output_classes) (final_output) loss = C.cross_entropy_with_softmax(z, label)
Conclusion: The probability that the sequence matches the label
All sizes are fixed, so I do not think that I need any dynamic axis and did not indicate.
However, CNTK is unhappy, and I get:
return cross_entropy_with_softmax(output_vector, target_vector, axis, name) RuntimeError: Currently if an operand of a elementwise operation has any dynamic axes, those must match the dynamic axes of the other operands
If (according to some examples) I define a label with a dynamic axis
label = input_variable(num_output_classes, dynamic_axes=[C.Axis.default_batch_axis()])
He no longer complains about this and moves on:
tf = np.split(training_features,num_minibatches) tl = np.split(training_labels, num_minibatches) for i in range(num_minibatches*num_passes):
But dying with this error:
File "C:\Users\Dev\Anaconda3\envs\cntk-py34\lib\site-packages\cntk\cntk_py.py", line 1745, in train_minibatch return _cntk_py.Trainer_train_minibatch(self, *args) RuntimeError: Node '__v2libuid__Plus561__v2libname__Plus552' (Plus operation): DataFor: FrameRange dynamic axis is inconsistent with matrix: {numTimeSteps:1, numParallelSequences:100, sequences:[{seqId:0, s:0, begin:0, end:1}, {seqId:1, s:1, begin:0, end:1}, {seqId:2, s:2, begin:0, end:1}, {seqId:3, s:3, begin:0, end:1}, {seq...
What do I need to do to fix this?