Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I create a model like this, there is a bug at runtime #32

Open
avan-debug opened this issue Jul 26, 2022 · 0 comments
Open

When I create a model like this, there is a bug at runtime #32

avan-debug opened this issue Jul 26, 2022 · 0 comments

Comments

@avan-debug
Copy link

state_input = Input(shape=(84, 84, 4), name='state_input', dtype='uint8')
advantage = Input(shape=(1,), name="adv")
state_input_1 = Lambda(layer_function)(state_input)
convlayer = Conv2D(32, (8, 8), strides=(4, 4), activation='relu', padding='valid')(state_input_1)
convlayer = Conv2D(64, (4, 4), strides=(2, 2), activation='relu', padding='valid')(convlayer)
convlayer = Conv2D(64, (3, 3), strides=(1, 1), activation='relu', padding='valid')(convlayer)
flattenlayer = Flatten()(convlayer)
denselayer = Dense(256, activation='relu')(flattenlayer)

out_actions = Dense(4, activation='softmax', name='output_actions')(denselayer)
out_value = Dense(1, name='output_value')(denselayer)
model = Model(inputs=[state_input, advantage], outputs=[out_actions, out_value])

pruned_model = pruning.factor_pruning(model, dense_prune_rate, conv_prune_rate, 'L2', num_classes=10)

Traceback (most recent call last):
File "/home/xys/primary_xingtian/xingtian-pruning/xt/structured_pruning/src/test/pruning_function_test.py", line 86, in
pruned_model = pruning.factor_pruning(model, dense_prune_rate, conv_prune_rate, 'L2', num_classes=10)
File "/home/xys/primary_xingtian/xingtian-pruning/xt/structured_pruning/src/pruning.py", line 77, in factor_pruning
num_new_neurons, num_new_filters, comp)
File "/home/xys/primary_xingtian/xingtian-pruning/xt/structured_pruning/src/pruning_helper_functions.py", line 259, in build_pruned_model
pruned_model.layers[i].set_weights(new_model_param[i])
File "/home/tank/miniconda3/envs/openmmlab/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1826, in set_weights
'shape %s' % (ref_shape, weight.shape))
ValueError: Layer weight shape (1911, 180) not compatible with provided weight shape (1886, 180)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant