【问题标题】:Tensorflow AutoEncoder: Current implementation does not yet support strides in the batch and depth dimensionsTensorflow AutoEncoder:当前的实现还不支持批量和深度维度的步幅
【发布时间】:2018-08-14 02:47:30
【问题描述】:

我正在尝试创建一个自动编码器解码器框架。 下面是我正在使用的代码

# 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)]]

【问题讨论】:

    标签: python tensorflow autoencoder


    【解决方案1】:

    Tensorflow documentation看到这个:

    必须有 strides[0] = strides[3] = 1。对于相同水平和顶点 strides 的最常见情况,strides = [1, stride, stride, 1]。

    strides[0] 是批处理维度,strides[3] 是通道(或深度)维度。

    尝试将步幅设置为 [1, 2, 2, 1]。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-05
      • 1970-01-01
      • 1970-01-01
      • 2022-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多