简体   繁体   中英

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.

In tensorflow's keras you write something like:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM