Hi,
I've been coding in C# for quite some time, and I'm fairly used to CNTK. I'm moving to Tensorflow.net because unfortunately CNTK has been dropped for future development.
This project really is fantastic, but the code structures are so hard to understand if you're new to the library as they are not C# style. An example is this code snippit from "DigitRecognitionCNN" from the examples solution:

Because "tf", and "tf_with" are lowercase, you'd likely assume they are a field, or private method, but they are not and as a result It's hard to tell at a glance whether the others are fields, or tensorflow bindings.
When you see:
tf_with(tf.name_scope("Input"), delegate
{
// Placeholders for inputs (x) and outputs(y)
x = tf.placeholder(tf.float32, shape: (-1, img_h, img_w, n_channels), name: "X");
y = tf.placeholder(tf.float32, shape: (-1, n_classes), name: "Y");
});
var conv1 = conv_layer(x, filter_size1, num_filters1, stride1, name: "conv1");
It looks from a glance that x and y are some part of the graph if they are inputs and outputs but they are actually fields belonging to DigitRecognitionCNN, but then the first convolutional layer uses it as it's input. Why isn't the input and output just a local variable that only used to tell the graph it's input and output shape?
This method defines a graph at the start of the method as a variable, and then it's referenced by nothing else, before being returned at the end. What happened to it? How was anything added to the graph without touching it?
Then there are nested tf_with methods, which seem to set fields; what does any of this do? Why do they need to be nested to set fields; and why are they fields belonging to "DigitRecognitionCNN" which is an example class, rather than properties of the network?
I genuinely don't think that I'm ever going to be able to grasp this because it's so unlike any C# that I have encountered before. The methods are quite opaque as to what they do.
Regardless, I'd like to thank anyone who has contributed to this project as it's certainly going to be useful for many, many people (just not thickos like me).
Hi,
I've been coding in C# for quite some time, and I'm fairly used to CNTK. I'm moving to Tensorflow.net because unfortunately CNTK has been dropped for future development.
This project really is fantastic, but the code structures are so hard to understand if you're new to the library as they are not C# style. An example is this code snippit from "DigitRecognitionCNN" from the examples solution:

Because "tf", and "tf_with" are lowercase, you'd likely assume they are a field, or private method, but they are not and as a result It's hard to tell at a glance whether the others are fields, or tensorflow bindings.
When you see:
It looks from a glance that x and y are some part of the graph if they are inputs and outputs but they are actually fields belonging to DigitRecognitionCNN, but then the first convolutional layer uses it as it's input. Why isn't the input and output just a local variable that only used to tell the graph it's input and output shape?
This method defines a graph at the start of the method as a variable, and then it's referenced by nothing else, before being returned at the end. What happened to it? How was anything added to the graph without touching it?
Then there are nested tf_with methods, which seem to set fields; what does any of this do? Why do they need to be nested to set fields; and why are they fields belonging to "DigitRecognitionCNN" which is an example class, rather than properties of the network?
I genuinely don't think that I'm ever going to be able to grasp this because it's so unlike any C# that I have encountered before. The methods are quite opaque as to what they do.
Regardless, I'd like to thank anyone who has contributed to this project as it's certainly going to be useful for many, many people (just not thickos like me).