0
点赞
收藏
分享

微信扫一扫

【Tensorflow】module ‘tensorflow‘ has no attribute ‘space_to_depth‘

小月亮06 2022-05-01 阅读 90

问题:

使用tensorflow 2定义模型的时候,提示:

module 'tensorflow' has no attribute 'space_to_depth'

分析:

tensorflow 2中space_to_depth的模块不同于tensorflow 1

解决:

import tensorflow as tf

tensorflow 1.x: tf.space_to_depth
tensorflow 2.x: tf.nn.space_to_depth

或者使用:

import tensorflow.compat.v1 as tf

tf.space_to_depth

举报

相关推荐

0 条评论