简体   繁体   中英

How extract layer in tensorflow or ValueError: Shape (?, 4096) must have rank 1

Operating System: CentOS 6 - official box for vagrant. No CUDA installed.

Installation: 1. Installed with Anaconda 4.0.9; 2. Tensorflow version: 0.10.0rc0; 3. Python 3.5, numpy 1.11.2, scipy 0.18.1;

Reproduce

It is standard VGG model with 16 layers. I tried extract vgg.fc2 layer with this code: http://pastebin.com/A1qd7g2e and have an error (stacktrace below). I also get this error after session.run was called. Did I try extract layer in right way?

Stacktrace - http://pastebin.com/eaQi1T0R

ps I'm a new user of tenserflow and don't know any attempted solutions. I found this issue - https://github.com/tensorflow/tensorflow/issues/3815 , but it is closed, I opened another - https://github.com/tensorflow/tensorflow/issues/4773 , any ideas would be helpful.

The reason was we can call graph node vgg.fc2 only after graph is running in sess.run. For more details see https://github.com/tensorflow/tensorflow/issues/4773

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM