Skip to main content
deleted 12 characters in body
Source Link
Nazim Kerimbekov
  • 4.8k
  • 11
  • 38
  • 58

I am using Keras version 2.3.1 and TensorFlow 2.0.0.

I induce the titular error on my instantiation of the first convolutional layer in my network:

``

model = Sequential([
    Conv2D(16, 3, input_shape=(1, 10000, 80)),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Dense(256),
    LeakyReLU(alpha=0.01),
    Dense(32),
    LeakyReLU(alpha=0.01),
    Dense(1, activation='sigmoid')])

``

As I am aware, the TF dimensional ordering should be set as (samples, rows, columns). My input is an array of shape 1000, 80.

I have tried all of the fixes I have found online, including:

``

K.common.set_image_dim_ordering('tf')
K.set_image_data_format('channels_last')
K.tensorflow_backend.set_image_dim_ordering('tf')
K.set_image_dim_ordering('tf')

``

However, all of these either do not change anything (as in the case of the first two), or fail at those lines (the latter two).

I am using Keras version 2.3.1 and TensorFlow 2.0.0.

I induce the titular error on my instantiation of the first convolutional layer in my network:

``

model = Sequential([
    Conv2D(16, 3, input_shape=(1, 10000, 80)),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Dense(256),
    LeakyReLU(alpha=0.01),
    Dense(32),
    LeakyReLU(alpha=0.01),
    Dense(1, activation='sigmoid')])

``

As I am aware, the TF dimensional ordering should be set as (samples, rows, columns). My input is an array of shape 1000, 80.

I have tried all of the fixes I have found online, including:

``

K.common.set_image_dim_ordering('tf')
K.set_image_data_format('channels_last')
K.tensorflow_backend.set_image_dim_ordering('tf')
K.set_image_dim_ordering('tf')

``

However all of these either do not change anything (as in the case of the first two), or fail at those lines (the latter two).

I am using Keras version 2.3.1 and TensorFlow 2.0.0.

I induce the titular error on my instantiation of the first convolutional layer in my network:

model = Sequential([
    Conv2D(16, 3, input_shape=(1, 10000, 80)),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Dense(256),
    LeakyReLU(alpha=0.01),
    Dense(32),
    LeakyReLU(alpha=0.01),
    Dense(1, activation='sigmoid')])

As I am aware, the TF dimensional ordering should be set as (samples, rows, columns). My input is an array of shape 1000, 80.

I have tried all of the fixes I have found online, including:

K.common.set_image_dim_ordering('tf')
K.set_image_data_format('channels_last')
K.tensorflow_backend.set_image_dim_ordering('tf')
K.set_image_dim_ordering('tf')

However, all of these either do not change anything (as in the case of the first two) or fail at those lines (the latter two).

Source Link
Brown Philip
  • 279
  • 1
  • 3
  • 14

Negative dimension size caused by subtracting 3 from 1 for 'conv2d_1/convolution' (op: 'Conv2D') with input shapes: [?,1,10000,80], [3,3,80,16]

I am using Keras version 2.3.1 and TensorFlow 2.0.0.

I induce the titular error on my instantiation of the first convolutional layer in my network:

``

model = Sequential([
    Conv2D(16, 3, input_shape=(1, 10000, 80)),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Conv2D(16, 3),
    LeakyReLU(alpha=0.01),
    MaxPooling2D(pool_size=3),
    Dense(256),
    LeakyReLU(alpha=0.01),
    Dense(32),
    LeakyReLU(alpha=0.01),
    Dense(1, activation='sigmoid')])

``

As I am aware, the TF dimensional ordering should be set as (samples, rows, columns). My input is an array of shape 1000, 80.

I have tried all of the fixes I have found online, including:

``

K.common.set_image_dim_ordering('tf')
K.set_image_data_format('channels_last')
K.tensorflow_backend.set_image_dim_ordering('tf')
K.set_image_dim_ordering('tf')

``

However all of these either do not change anything (as in the case of the first two), or fail at those lines (the latter two).