diff --git a/src/TensorFlowNET.Core/Keras/Layers/Conv.cs b/src/TensorFlowNET.Core/Keras/Layers/Conv.cs
index efa79e00..aeb37128 100644
--- a/src/TensorFlowNET.Core/Keras/Layers/Conv.cs
+++ b/src/TensorFlowNET.Core/Keras/Layers/Conv.cs
@@ -56,7 +56,9 @@ namespace Tensorflow.Keras.Layers
protected override void build(TensorShape input_shape)
{
int channel_axis = data_format == "channels_first" ? 1 : -1;
- int input_dim = input_shape.Dimensions[input_shape.NDim - 1];
+ int input_dim = channel_axis < 0 ?
+ input_shape.Dimensions[input_shape.NDim + channel_axis] :
+ input_shape.Dimensions[channel_axis];
var kernel_shape = new int[] { kernel_size[0], kernel_size[1], input_dim, filters };
kernel = add_weight(name: "kernel",
shape: kernel_shape,
@@ -102,7 +104,7 @@ namespace Tensorflow.Keras.Layers
}
else
{
- outputs = nn_ops.bias_add(outputs, bias._AsTensor(), data_format: "NHWC");
+ outputs = nn_ops.bias_add(outputs, bias, data_format: "NHWC");
}
}
diff --git a/src/TensorFlowNET.Core/Keras/Layers/Layer.cs b/src/TensorFlowNET.Core/Keras/Layers/Layer.cs
index db089959..a0a151ef 100644
--- a/src/TensorFlowNET.Core/Keras/Layers/Layer.cs
+++ b/src/TensorFlowNET.Core/Keras/Layers/Layer.cs
@@ -206,12 +206,14 @@ namespace Tensorflow.Keras.Layers
_updates.AddRange(updates_op);
}
+ // Determine layer name (non-unique).
protected virtual void _init_set_name(string name, bool zero_based = true)
{
+ var base_name = name;
+ _name = name;
if (name == null)
- _name = base_layer_utils.unique_layer_name(generic_utils.to_snake_case(this.GetType().Name), zero_based: zero_based);
- else
- _name = name;
+ (_name, base_name) = _make_unique_name();
+ _base_name = base_name;
}
protected virtual (string, string) _make_unique_name()
diff --git a/src/TensorFlowNET.Core/Layers/Layer.cs b/src/TensorFlowNET.Core/Layers/Layer.cs
index e8844d46..ff0fd28e 100644
--- a/src/TensorFlowNET.Core/Layers/Layer.cs
+++ b/src/TensorFlowNET.Core/Layers/Layer.cs
@@ -67,13 +67,6 @@ namespace Tensorflow.Layers
return outputs;
}
- protected override void _init_set_name(string name, bool zero_based = true)
- {
- // Determine layer name (non-unique).
- base._init_set_name(name, zero_based: zero_based);
- _base_name = this.name;
- }
-
protected virtual void _add_elements_to_collection(Operation[] elements, string[] collection_list)
{
foreach(var name in collection_list)
diff --git a/src/TensorFlowNET.Core/Operations/NnOps/Conv2dParams.cs b/src/TensorFlowNET.Core/Operations/NnOps/Conv2dParams.cs
new file mode 100644
index 00000000..de480692
--- /dev/null
+++ b/src/TensorFlowNET.Core/Operations/NnOps/Conv2dParams.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Operations
+{
+ public class Conv2dParams
+ {
+ public string Name { get; set; }
+
+ ///
+ /// An optional `string` from: `"NHWC", "NCHW"`. Defaults to `"NHWC"`.
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the data is stored in the order of:
+ /// [batch, height, width, channels].
+ ///
+ public string DataFormat { get; set; } = "NHWC";
+
+ ///
+ /// Must be one of the following types: `half`, `bfloat16`, `float32`, `float64`.
+ /// A 4-D tensor. The dimension order is interpreted according to the value
+ ///
+ public Tensor Input { get; set; }
+
+ ///
+ /// A 4-D tensor of shape
+ ///
+ public Tensor Filter { get; set; }
+
+ ///
+ /// The stride of the sliding window for each
+ /// dimension of `input`. The dimension order is determined by the value of
+ /// `data_format`, see below for details.
+ ///
+ public int[] Strides { get; set; }
+
+ ///
+ /// A `string` from: `"SAME", "VALID", "EXPLICIT"`.
+ ///
+ public string Padding { get; set; }
+
+ public int[] ExplicitPaddings { get; set; } = new int[0];
+
+ public bool UseCudnnOnGpu { get; set; } = true;
+
+ public int[] Dilations { get; set; } = new [] { 1, 1, 1, 1 };
+
+ public Conv2dParams()
+ {
+
+ }
+ }
+}
diff --git a/src/TensorFlowNET.Core/Operations/NnOps/_NonAtrousConvolution.cs b/src/TensorFlowNET.Core/Operations/NnOps/_NonAtrousConvolution.cs
index e6a3958a..c742884a 100644
--- a/src/TensorFlowNET.Core/Operations/NnOps/_NonAtrousConvolution.cs
+++ b/src/TensorFlowNET.Core/Operations/NnOps/_NonAtrousConvolution.cs
@@ -11,7 +11,7 @@ namespace Tensorflow.Operations
public string name;
public int[] strides;
public string data_format;
- private Func