Search code examples
machine-learninginputneural-networkcntk

Additional external input to layer


I am trying to implement architecture similar to one presented in https://www.jstage.jst.go.jp/article/transinf/E101.D/2/E101.D_2017EDP7165/_pdf using Microsoft's CNTK framework. So I need to add inputs to one or more hidden layers which do not represent the outputs from previous layer but are externally defined.

I've tried by splicing standard layer and these additional inputs into a single layer, but then I obtain a layer with multiple inputs. And I am also not sure how can I make partial connection of two consecutive layers in CNTK. I have looked the documentation but haven't found any function that could help me. Is this possible to implement with CNTK?


Solution

  • code = C.input_variable()
    input_tensor = C.input_variable()
    
    denseout1 = Dense()(C.splice(input_tensor, code, axis=...))
    denseout2= Dense()(C.splice(denseout1, code, axis=...))
    

    ** I answered here so that anyone looking at this gets help too.