Search code examples
cntk

access trained parameter in CNTK


With a model like this, how can one access the trained parameters like weight and bias of each layer?

model = Sequential ([
                Dense(xx, activation=cntk.sigmoid),
                Dense(outputs)])
z = model(features)

Thanks.


Solution

  • The specific mechanisms are shown in this tutorial. Here is the sample that shows how to access the parameters:

    model = create_model()

    print(len(model.layers))

    print(model.layers[0].E.shape)

    print(model.layers[2].b.value)