Skip to content

Commit 271b066

Browse files
committed
change default value for Conv1D.
1 parent 974855c commit 271b066

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/TensorFlowNET.Keras/Layers/LayersApi.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,35 +86,30 @@ public BatchNormalization BatchNormalization(int axis = -1,
8686
/// <returns>A tensor of rank 3 representing activation(conv1d(inputs, kernel) + bias).</returns>
8787
public Conv1D Conv1D(int filters,
8888
Shape kernel_size,
89-
int? strides = null,
89+
int strides = 1,
9090
string padding = "valid",
91-
string data_format = null,
92-
int? dilation_rate = null,
91+
string data_format = "channels_last",
92+
int dilation_rate = 1,
9393
int groups = 1,
9494
string activation = null,
9595
bool use_bias = true,
9696
string kernel_initializer = "glorot_uniform",
9797
string bias_initializer = "zeros")
98-
{
99-
// Special case: Conv1D will be implemented as Conv2D with H=1, so we need to add a 1-sized dimension to the kernel.
100-
// Lower-level logic handles the stride and dilation_rate, but the kernel_size needs to be set properly here.
101-
102-
return new Conv1D(new Conv1DArgs
98+
=> new Conv1D(new Conv1DArgs
10399
{
104100
Rank = 1,
105101
Filters = filters,
106102
KernelSize = kernel_size ?? new Shape(1, 5),
107-
Strides = strides == null ? 1 : strides,
103+
Strides = strides,
108104
Padding = padding,
109105
DataFormat = data_format,
110-
DilationRate = dilation_rate == null ? 1 : dilation_rate,
106+
DilationRate = dilation_rate,
111107
Groups = groups,
112108
UseBias = use_bias,
113109
Activation = GetActivationByName(activation),
114110
KernelInitializer = GetInitializerByName(kernel_initializer),
115111
BiasInitializer = GetInitializerByName(bias_initializer)
116112
});
117-
}
118113

119114
/// <summary>
120115
/// 2D convolution layer (e.g. spatial convolution over images).

0 commit comments

Comments
 (0)