Tensorflow AutoEncoder:当前的实现还不支持批量和深度维度上的步幅
Tensorflow AutoEncoder: Current implementation does not yet support strides in the batch and depth dimensions
我正在尝试创建一个自动编码器解码器框架。
下面是我使用的代码
# Define convolution layers
def conv(layer_name, input_X, shape, strides, padding = "SAME"):
with tf.variable_scope(layer_name):
W = tf.get_variable("W", shape = shape, dtype=tf.float32)
return tf.nn.conv2d(input_X, W, strides, padding), W
# Layer1 convolution
encoder_layer1, W1 = conv("encode_layer1", X, [28, 28, 1, 10], [2,2,2,2])
我收到以下错误
InvalidArgumentError (see above for traceback): Current implementation does not yet support strides in the batch and depth dimensions.
[[Node: encode_layer1/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", strides=[2, 2, 2, 2], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_X_0_0, encode_layer1/W/read)]]
从 Tensorflow documentation 看到这个:
Must have strides[0] = strides[3] = 1. For the most common case of the same horizontal and vertices strides, strides = [1, stride, stride, 1].
strides[0] 是批量维度,strides[3] 是通道(或深度)维度。
尝试将步幅设置为 [1, 2, 2, 1]。
我正在尝试创建一个自动编码器解码器框架。 下面是我使用的代码
# Define convolution layers
def conv(layer_name, input_X, shape, strides, padding = "SAME"):
with tf.variable_scope(layer_name):
W = tf.get_variable("W", shape = shape, dtype=tf.float32)
return tf.nn.conv2d(input_X, W, strides, padding), W
# Layer1 convolution
encoder_layer1, W1 = conv("encode_layer1", X, [28, 28, 1, 10], [2,2,2,2])
我收到以下错误
InvalidArgumentError (see above for traceback): Current implementation does not yet support strides in the batch and depth dimensions.
[[Node: encode_layer1/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", strides=[2, 2, 2, 2], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_X_0_0, encode_layer1/W/read)]]
从 Tensorflow documentation 看到这个:
Must have strides[0] = strides[3] = 1. For the most common case of the same horizontal and vertices strides, strides = [1, stride, stride, 1].
strides[0] 是批量维度,strides[3] 是通道(或深度)维度。
尝试将步幅设置为 [1, 2, 2, 1]。