[英]Translating Conv1D Layer from pytorch to tensorflow/keras
I want to create an equal keras layer from this source:我想从此来源创建一个相等的 keras 层:
Layer=torch.nn.Conv1d(in_features, out_features, 1)
My Input is shaped (Batch_size,Channel,Width) This Layer is compiled to:我的输入形状为 (Batch_size,Channel,Width) 此图层编译为:
Conv1d(10, 256, kernel_size=(1,), stride=(1,))
By pytorch.通过 pytorch。 How can I express this Layer in tensorflow?
如何在 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:在 tensorflow 的 keras 中,您可以编写如下内容:
layer1 = tf.keras.layers.Conv1D(filters=256, kernel_size=1)(layer0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.