首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在急切模式下实例化InceptionResNetV2时出错

在急切模式下实例化InceptionResNetV2时出错
EN

Stack Overflow用户
提问于 2018-08-25 21:04:30
回答 1查看 127关注 0票数 1
代码语言:javascript
复制
tensorFlow version (use command below): 1.10
Python version:3.6
OS Platform: window 10

描述问题:

我使用了tf.enable_eager_execution()和create InceptionResNetV2模式从here将是错误的,只有InceptionResNetV2。我需要使用tf.enable_eager_execution()不能没有的东西。

如何修复它?

创建模式

代码语言:javascript
复制
import tensorflow as tf
tf.enable_eager_execution()
image_model =tf.keras.applications.InceptionResNetV2(include_top=False, weights='imagenet')

错误

代码语言:javascript
复制
TypeError Traceback (most recent call last)
in ()
----> 1 image_model =tf.keras.applications.InceptionResNetV2(include_top=False, weights='imagenet')

D:\anaconda\lib\site-packages\tensorflow\python\keras\applications\inception_resnet_v2.py in InceptionResNetV2(include_top, weights, input_tensor, input_shape, pooling, classes)
304 for block_idx in range(1, 11):
305 x = inception_resnet_block(
--> 306 x, scale=0.17, block_type='block35', block_idx=block_idx)
307
308 # Mixed 6a (Reduction-A block): 17 x 17 x 1088

D:\anaconda\lib\site-packages\tensorflow\python\keras\applications\inception_resnet_v2.py in inception_resnet_block(x, scale, block_type, block_idx, activation)
187 output_shape=K.int_shape(x)[1:],
188 arguments={'scale': scale},
--> 189 name=block_name)([x, up])
190 if activation is not None:
191 x = Activation(activation, name=block_name + '_ac')(x)

D:\anaconda\lib\site-packages\tensorflow\python\keras\engine\base_layer.py in call(self, inputs, *args, **kwargs)
745 input_shapes = nest.map_structure(lambda x: x.shape, inputs)
746
--> 747 output_shapes = self.compute_output_shape(input_shapes)
748 output_shapes = nest.flatten(output_shapes)
749 outputs = [

D:\anaconda\lib\site-packages\tensorflow\python\keras\layers\core.py in compute_output_shape(self, input_shape)
678
679 def compute_output_shape(self, input_shape):
--> 680 input_shape = tuple(tensor_shape.TensorShape(input_shape).as_list())
681
682 if self._output_shape is None:

D:\anaconda\lib\site-packages\tensorflow\python\framework\tensor_shape.py in init(self, dims)
539 else:
540 # Got a list of dimensions
--> 541 self._dims = [as_dimension(d) for d in dims_iter]
542 self._ndims = None
543

D:\anaconda\lib\site-packages\tensorflow\python\framework\tensor_shape.py in (.0)
539 else:
540 # Got a list of dimensions
--> 541 self._dims = [as_dimension(d) for d in dims_iter]
542 self._ndims = None
543

D:\anaconda\lib\site-packages\tensorflow\python\framework\tensor_shape.py in as_dimension(value)
480 return value
481 else:
--> 482 return Dimension(value)
483
484

D:\anaconda\lib\site-packages\tensorflow\python\framework\tensor_shape.py in init(self, value)
35 raise TypeError("Cannot convert %s to Dimension" % value)
36 else:
---> 37 self._value = int(value)
38 if (not isinstance(value, compat.bytes_or_text_types) and
39 self._value != value):

TypeError: int() argument must be a string, a bytes-like object or a number, not 'TensorShape'
EN

回答 1

Stack Overflow用户

发布于 2018-08-25 21:40:00

实际上,在启用tf.enable_eager_execution()时,运行tf.keras.applications.InceptionResNetV2()存在一个错误。我看到一个社区成员已经在TensorFlow Github page上提交了一个bug问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52017600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档