C# CNTK添加双向LSTM层

C# CNTK添加双向LSTM层,c#,cntk,C#,Cntk,从这里开始: 我在问C#如何实现这一功能: 在Brainscript中: BiRecurrentLSTMLayer {outDim} = { F = RecurrentLSTMLayer {outDim, goBackwards=false} G = RecurrentLSTMLayer {outDim, goBackwards=true} apply (x) = Splice (F(x):G(x)) }.apply 该功能按顺序执行: hiddenDim = 150

从这里开始:

我在问C#如何实现这一功能:

在Brainscript中:

BiRecurrentLSTMLayer {outDim} = {
    F = RecurrentLSTMLayer {outDim, goBackwards=false}
    G = RecurrentLSTMLayer {outDim, goBackwards=true}
    apply (x) = Splice (F(x):G(x))
}.apply
该功能按顺序执行:

hiddenDim = 150      ##### changed from 300 to 150

model = Sequential (
    EmbeddingLayer {embDim} :
    ###OneWordLookahead :                   ##### removed
    BatchNormalizationLayer {} :
    BiRecurrentLSTMLayer {hiddenDim} :
    BatchNormalizationLayer {} :
    DenseLayer {labelDim}
)
LSTM在这里实现:

到目前为止,我已经做到了:

Function BiRecurrentLSTMLayer(Variable input, int outDim)
{

    Function F = Layers.LSTMLayer(input, outDim, 50, 35, 50, Device, "");
    Function G = Layers.LSTMLayer(input, outDim, 50, 35, 50, Device, "");

    return CNTK.CNTKLib.Splice(new VariableVector() { F, G }, null, "");
}
正如你所看到的,没有X'ing的F!或者倒退

要获得LSTM“向前”和“向后”设置,如何拼接和添加为阵列函数

编辑:

我已经涉猎过,在以下网站上找不到任何文档:
CNTK.CNTKLib.ForwardBackward
请参阅代码:

Function F = LSTMLayer(input, numOutput / 2, embedDim, hiddenDim / 2, cellDim, device, "");
Function G = LSTMLayer(input, (int)((numOutput / 2.0) + 0.5D), embedDim, hiddenDim / 2, cellDim, device, "");

return CNTK.CNTKLib.ForwardBackward(G, F, blankTokenId, delayConstraint, name);
但是得到错误:

System.ApplicationException:“还原操作还原元素:还原轴的数目(1)超过了操作数形状“[]”的秩(0)


那一定太难了吧?没有答案或评论。。。