简体   繁体   中英

How to get tensor Shape python

I have an issue with tensors.

X.get_shape() returns (?, ?, ?, 512)

Whereas when I try to concatenate X and an other vector X=Concatenate()([X,X_add]) , it raises the exception.

A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 32, 32, 512), (None, 256, 256, 64)]

How do I get those shapes in order to use Cropp2D in my resnet.

Sometimes you have to reshape tensors before concatenating. But that won't solve your problem here, because the two tensors are of different size: 32*32*512.= 256* 256*64.

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