Skip to content

SeparableConv1D returns incorrect symbolic output shape for valid strided inputs #22496

@ningxiudg

Description

@ningxiudg

Bug report

keras.layers.SeparableConv1D computes a correct output shape for eager tensors, but the symbolic output shape from keras.Input() is wrong when using padding='valid' and strides > 1.

Reproduction

import keras
import tensorflow as tf
import numpy as np

x_eager = tf.constant(np.random.rand(4, 10, 12), dtype=tf.float32)
x_sym = keras.Input(shape=(10, 12))

layer = keras.layers.SeparableConv1D(64, 11, strides=5, padding='valid', activation='relu')

y_eager = layer(x_eager)
y_sym = layer(x_sym)

print(y_eager.shape)
print(y_sym.shape)

Expected result

Both outputs should report the same spatial shape.

Actual result

  • Eager output shape: (4, 10, 64)
  • Symbolic output shape: (None, 0, 64)

This indicates incorrect static shape inference for SeparableConv1D.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions