tf-keras-surgeon icon indicating copy to clipboard operation
tf-keras-surgeon copied to clipboard

insert_layer() doesn't insert anything

Open Kiro02 opened this issue 5 years ago • 1 comments

Hi, I have a trouble with inserting a new layer into my model.

I have a model like this:

Model: "sequential_1"
_____________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
conv2d_3 (Conv2D)            (None, 26, 26, 32)        320       
_________________________________________________________________
conv2d_4 (Conv2D)            (None, 24, 24, 32)        9248      
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 12, 12, 32)        0         
_________________________________________________________________
flatten_1 (Flatten)          (None, 4608)              0         
_________________________________________________________________
dense_3 (Dense)              (None, 64)                294976    
_________________________________________________________________
dense_4 (Dense)              (None, 10)                650       
=================================================================
Total params: 305,194
Trainable params: 305,194
Non-trainable params: 0
_________________________________________________________________

and I used tf-keras-surgeon on this model like:

from tfkerassurgeon import Surgeon
surgeon = Surgeon(model)
surgeon.add_job('insert_layer', model.layers[3], new_layer=Dropout(0.2))
new_model = surgeon.operate()

However, there was nothing inserted. Does anyone have any idea? I'm using tf.keras on tensorflow-gpu==2.0.0-beta1

Thank you.

Kiro02 avatar Nov 14 '19 06:11 Kiro02

Thanks for the bug report, I'll look into this.

If you identify any more issues with TF2.0, please let me know.

Thanks!

Raukk avatar Nov 14 '19 13:11 Raukk