SergeantIdiot
SergeantIdiot

Reputation: 113

Translating Conv1D Layer from pytorch to tensorflow/keras

I want to create an equal keras layer from this source:

Layer=torch.nn.Conv1d(in_features, out_features, 1)

My Input is shaped (Batch_size,Channel,Width) This Layer is compiled to:

Conv1d(10, 256, kernel_size=(1,), stride=(1,))

By pytorch. How can I express this Layer in tensorflow? I have so far this:

layer1 = tf.keras.layers.Conv1D(in_features-out_features+1, kernel_size=1)

But I am not confident that this will is the right approach.

Upvotes: 0

Views: 230

Answers (1)

Mr. For Example
Mr. For Example

Reputation: 4313

In tensorflow's keras you write something like:

layer1 = tf.keras.layers.Conv1D(filters=256, kernel_size=1)(layer0)

Upvotes: 1

Related Questions