第一个帖子:)如果我做错了什么,别开枪!在
有没有更简捷的方法来定义下面的形状?它是可行的,但有点冗长,没有活力。在
def neural_net_image_input(image_shape):
"""
Return a Tensor for a batch of image input
: image_shape: Shape of the images (taken from CIFAR10)
: return: Tensor for image input.
"""
x = tf.placeholder(tf.float32, shape=[None, image_shape[0], image_shape[1], image_shape[2]], name='x')
return x
我已经搜索了大约一个小时没有成功,在某某和其他网站。我最初确实试过这个
^{pr2}$但有错误(我明白)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'
那么,有没有一种方法可以将元组更改为我的形状参数中可以接受的形式?在
使用元组加法:
或者在最新的Python版本中使用iterable解压归纳:
^{pr2}$相关问题 更多 >
编程相关推荐