0

When I create and load a deep learning model, an error pops up that a non-type is returned. I want the model to be loaded normally, not a non-type

def base_network_MLP(dimension, input_dim):

    x = Dense(20, activation='relu')(input_dim)
    x = Dense(dimension, activation='relu')(x)


    return x


def siamese_MLP(dimension, input_dim):



    input_a = Input(shape=input_dim, name='left_input')
    input_b = Input(shape=input_dim, name='right_input')
    vector_output_a = base_network_MLP(dimension, input_a)

    vector_output_b = base_network_MLP(dimension, input_b)

    output = Lambda(euclidean_distance, name='output_layer')([vector_output_a, vector_output_b])

    # define model
    model = Model([input_a, input_b], output)
    # plot_model(model, show_shapes=True, show_layer_names=True)
    return model

a = siamese_MLP(6,(100))
a.save_weights('abc.h5')
model = siamese_MLP(6,(100)
model.compile(loss='mse', optimizer='sgd')
c = model.load_weights('abc.h5')

c.summary()

AttributeError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_32844\188463796.py in ----> 1 c.summary()

AttributeError: 'NoneType' object has no attribute 'summary'

0 Answers0