python - tf.contrib.image.rotate() 导致错误 - 具有多个元素的数组的真值不明确。使用 a.any() 或 a.all()
问题描述
我正在尝试运行
zzz = tf.contrib.image.rotate(image, 0.0348, interpolation='NEAREST')
但得到错误:
ValueError Traceback (last last call last) in () 5 6 ----> 7 zzz = tf.contrib.image.rotate(image, 0.0348, interpolation='NEAREST') 8 9 # zz = []
/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/image/python/ops/image_ops.py 在旋转(图像,角度,插值,名称) 88 图像,89 角度_to_projective_transforms(角度,图像高度,图像宽度), ---> 90 interpolation=interpolation) 91 如果 image_or_images.get_shape().ndims 为 None: 92 raise TypeError("image_or_images rank must be statically known")
/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/image/python/ops/image_ops.py in transform(images, transforms, interpolation, output_shape, name) 273 如果 output_shape 为 None:274 output_shape = tensor_util.constant_value(--> 275 array_ops.shape(images)[1:3]) 或 array_ops.shape(images)[1:3] 276 277 output_shape = ops.convert_to_tensor(
ValueError:具有多个元素的数组的真值不明确。使用 a.any() 或 a.all()
我错过了什么?
更新:
我在谷歌合作上使用 Tensorfloe 1.12.0。运行下面的代码给出了同样的错误
image = np.zeros((50, 90, 3)); tf.contrib.image.rotate(image, .3)
急切的前任时会出现此错误消息。使用 tf.enable_eager_execution() 启用
解决方案
推荐阅读
- javascript - 在节点中进行预签名时,AWS 访问 ID 密钥不存在
- python - 在 mssql pyodbc 连接中使用“where”和“in”条件在 MSSQL 中传递列表
- php - Parrot-os如何安装php5.6
- android - “对象?”类型的值 不能分配给“String”类型的变量,并且左操作数不能为空,因此永远不会执行右操作数
- javascript - 如何使用Vue从父级中的多个子组件中获取值?
- deno - Deno - 更新天龙版本
- php - Autobahn-js 无法连接到 Ratchet 服务器 (Wamp)
- flutter - 使用颤振处理 Appcheck 时出错
- python - 在函数参数类型中使用普通 {} 和 typing.Dict 有什么区别?
- reactjs - 使用空数组获取数据加载页面