change the Model: given automatically by keras in model.summary() output

后端 未结 2 1886
灰色年华
灰色年华 2021-01-21 17:35

When calling the command:

print(model.summary())

I get the following output:

How can I rena

相关标签:
2条回答
  • 2021-01-21 17:59

    there is the argument 'name'

    in functional format

    inp = Input((10,))
    out = Dense(1)(inp)
    
    m = Model(inp, out, name='model_XXX')
    m.summary()
    

    in sequential format

    m = Sequential([Dense(1, input_dim=10)], name='model_XXX')
    m.summary()
    

    if u have a pre-trained model you can simply do

    m.fit(...)
    m._name = 'model_XXX' # try with m.name if it raise error due to TF version
    m.summary()
    
    0 讨论(0)
  • 2021-01-21 18:11

    If you want to rename an already built model, it can be done like this:

    model.name = 'yourname'
    
    0 讨论(0)
提交回复
热议问题