From c48cce4e7d944280b70982fa3be567413cbbe639 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Sun, 5 Jul 2020 13:34:03 -0700 Subject: [PATCH] Suppress CS0649 (Field 'name' is never assigned to, and will always have its default value) --- src/TensorFlowNET.Core/Keras/Engine/Sequential.cs | 2 ++ src/TensorFlowNET.Core/Keras/Layers/Layer.cs | 2 ++ .../Operations/Initializers/RandomUniform.cs | 8 ++++++++ src/TensorFlowNET.Core/Training/Saving/Saver.cs | 2 ++ 4 files changed, 14 insertions(+) diff --git a/src/TensorFlowNET.Core/Keras/Engine/Sequential.cs b/src/TensorFlowNET.Core/Keras/Engine/Sequential.cs index 3ab76832..c6fcd68b 100644 --- a/src/TensorFlowNET.Core/Keras/Engine/Sequential.cs +++ b/src/TensorFlowNET.Core/Keras/Engine/Sequential.cs @@ -20,7 +20,9 @@ namespace Tensorflow.Keras.Engine { public class Sequential : Model, ITensorFlowObject { +#pragma warning disable CS0649 // Field 'Sequential._is_graph_network' is never assigned to, and will always have its default value false bool _is_graph_network; +#pragma warning restore CS0649 // Field 'Sequential._is_graph_network' is never assigned to, and will always have its default value false #pragma warning disable CS0169 // The field 'Sequential.outputs' is never used Tensor[] outputs; #pragma warning restore CS0169 // The field 'Sequential.outputs' is never used diff --git a/src/TensorFlowNET.Core/Keras/Layers/Layer.cs b/src/TensorFlowNET.Core/Keras/Layers/Layer.cs index 789ffee1..5118cb71 100644 --- a/src/TensorFlowNET.Core/Keras/Layers/Layer.cs +++ b/src/TensorFlowNET.Core/Keras/Layers/Layer.cs @@ -63,7 +63,9 @@ namespace Tensorflow.Keras.Layers private List _inbound_nodes; public List inbound_nodes => _inbound_nodes; +#pragma warning disable CS0649 // Field 'Layer._outbound_nodes' is never assigned to, and will always have its default value null private List _outbound_nodes; +#pragma warning restore CS0649 // Field 'Layer._outbound_nodes' is never assigned to, and will always have its default value null public List outbound_nodes => _outbound_nodes; #pragma warning disable CS0169 // The field 'Layer._initial_weights' is never used diff --git a/src/TensorFlowNET.Core/Operations/Initializers/RandomUniform.cs b/src/TensorFlowNET.Core/Operations/Initializers/RandomUniform.cs index 59333c84..bd082214 100644 --- a/src/TensorFlowNET.Core/Operations/Initializers/RandomUniform.cs +++ b/src/TensorFlowNET.Core/Operations/Initializers/RandomUniform.cs @@ -18,10 +18,18 @@ namespace Tensorflow.Operations.Initializers { public class RandomUniform : IInitializer { +#pragma warning disable CS0649 // Field 'RandomUniform.seed' is never assigned to, and will always have its default value private int? seed; +#pragma warning restore CS0649 // Field 'RandomUniform.seed' is never assigned to, and will always have its default value +#pragma warning disable CS0649 // Field 'RandomUniform.minval' is never assigned to, and will always have its default value 0 private float minval; +#pragma warning restore CS0649 // Field 'RandomUniform.minval' is never assigned to, and will always have its default value 0 +#pragma warning disable CS0649 // Field 'RandomUniform.maxval' is never assigned to, and will always have its default value 0 private float maxval; +#pragma warning restore CS0649 // Field 'RandomUniform.maxval' is never assigned to, and will always have its default value 0 +#pragma warning disable CS0649 // Field 'RandomUniform.dtype' is never assigned to, and will always have its default value private TF_DataType dtype; +#pragma warning restore CS0649 // Field 'RandomUniform.dtype' is never assigned to, and will always have its default value public RandomUniform() { diff --git a/src/TensorFlowNET.Core/Training/Saving/Saver.cs b/src/TensorFlowNET.Core/Training/Saving/Saver.cs index d8de44fb..d24fc5b9 100644 --- a/src/TensorFlowNET.Core/Training/Saving/Saver.cs +++ b/src/TensorFlowNET.Core/Training/Saving/Saver.cs @@ -42,7 +42,9 @@ namespace Tensorflow private bool _is_built; private SaverDef.Types.CheckpointFormatVersion _write_version; private bool _pad_step_number; +#pragma warning disable CS0649 // Field 'Saver._filename' is never assigned to, and will always have its default value null private string _filename; +#pragma warning restore CS0649 // Field 'Saver._filename' is never assigned to, and will always have its default value null private bool _is_empty; private float _next_checkpoint_time; private bool _save_relative_paths;