I'm trying to understand how to use a Conv1D layer to extract features out of a vector. Here's my code:
import tensorflow as tf
from tensorflow.keras import models, layers
import numpy as np
# make 100 40000-dimensional vectors:
x = []
for i in range(100):
array_of_random_floats = np.random.random_sample((40000))
x.append(array_of_random_floats)
x = np.asarray(x)
# make 100 80000-dimensional vectors:
y = []
for i in range(100):
array_of_random_floats = np.random.random_sample((80000))
y.append(array_of_random_floats)
y = np.asarray(y)
model = models.Sequential([
layers.Input((40000,)),
layers.Conv1D(padding='same', kernel_initializer='Orthogonal', filters=16, kernel_size=16, activation=None, strides=2),
# ...
layers.Dense(80000)
])
model.compile(loss='mse', optimizer='adam', metrics=['accuracy'])
history = model.fit(x=x,
y=y,
epochs=100)
This produces the following error:
ValueError: Input 0 of layer conv1d_20 is incompatible with the layer: : expected min_ndim=3, found ndim=2. Full shape received: (None, 40000)
I'm a bit confused as the documentation for the Conv1D layer seems to suggest that it can process vectors...