@@ -43,7 +43,9 @@ namespace Tensorflow.Eager | |||||
if (!should_record) return should_record; | if (!should_record) return should_record; | ||||
Tensor[] op_outputs; | Tensor[] op_outputs; | ||||
#pragma warning disable CS0219 // Variable is assigned but its value is never used | |||||
bool op_outputs_tuple_created = false; | bool op_outputs_tuple_created = false; | ||||
#pragma warning restore CS0219 // Variable is assigned but its value is never used | |||||
var unused_output_indices = gradient_exclustions.OpGradientUnusedOutputIndices(op_name); | var unused_output_indices = gradient_exclustions.OpGradientUnusedOutputIndices(op_name); | ||||
if (unused_output_indices != null) | if (unused_output_indices != null) | ||||
{ | { | ||||
@@ -59,7 +61,9 @@ namespace Tensorflow.Eager | |||||
op_outputs = results; | op_outputs = results; | ||||
Tensor[] op_inputs; | Tensor[] op_inputs; | ||||
#pragma warning disable CS0219 // Variable is assigned but its value is never used | |||||
bool op_inputs_tuple_created = false; | bool op_inputs_tuple_created = false; | ||||
#pragma warning restore CS0219 // Variable is assigned but its value is never used | |||||
var unused_input_indices = gradient_exclustions.OpGradientUnusedInputIndices(op_name); | var unused_input_indices = gradient_exclustions.OpGradientUnusedInputIndices(op_name); | ||||
if(unused_input_indices != null) | if(unused_input_indices != null) | ||||
{ | { | ||||
@@ -83,7 +83,9 @@ namespace Tensorflow | |||||
var combined_return_elements = new List<ITensorOrOperation>(); | var combined_return_elements = new List<ITensorOrOperation>(); | ||||
int outputs_idx = 0; | int outputs_idx = 0; | ||||
#pragma warning disable CS0219 // Variable is assigned but its value is never used | |||||
int opers_idx = 0; | int opers_idx = 0; | ||||
#pragma warning restore CS0219 // Variable is assigned but its value is never used | |||||
foreach(var name in requested_return_elements) | foreach(var name in requested_return_elements) | ||||
{ | { | ||||
if (name.Contains(":")) | if (name.Contains(":")) | ||||
@@ -393,7 +393,9 @@ namespace Tensorflow | |||||
// Aggregate multiple gradients, and convert [] to None. | // Aggregate multiple gradients, and convert [] to None. | ||||
if (out_grad.Count > 0) | if (out_grad.Count > 0) | ||||
{ | { | ||||
#pragma warning disable CS0219 // Variable is assigned but its value is never used | |||||
string used = ""; | string used = ""; | ||||
#pragma warning restore CS0219 // Variable is assigned but its value is never used | |||||
if (out_grad.Count < 2) | if (out_grad.Count < 2) | ||||
{ | { | ||||
used = "nop"; | used = "nop"; | ||||
@@ -38,8 +38,10 @@ namespace Tensorflow.Keras.Utils | |||||
IInitializer initializer = null, | IInitializer initializer = null, | ||||
bool trainable = true) | bool trainable = true) | ||||
{ | { | ||||
#pragma warning disable CS0219 // Variable is assigned but its value is never used | |||||
var initializing_from_value = false; | var initializing_from_value = false; | ||||
bool use_resource = true; | bool use_resource = true; | ||||
#pragma warning restore CS0219 // Variable is assigned but its value is never used | |||||
ops.init_scope(); | ops.init_scope(); | ||||
@@ -34,7 +34,9 @@ namespace Tensorflow.Operations | |||||
var dilation_rate_tensor = ops.convert_to_tensor(dilation_rate, TF_DataType.TF_INT32, name: "dilation_rate"); | var dilation_rate_tensor = ops.convert_to_tensor(dilation_rate, TF_DataType.TF_INT32, name: "dilation_rate"); | ||||
var rate_shape = dilation_rate_tensor.TensorShape; | var rate_shape = dilation_rate_tensor.TensorShape; | ||||
var num_spatial_dims = rate_shape.dims[0]; | var num_spatial_dims = rate_shape.dims[0]; | ||||
#pragma warning disable CS0219 // Variable is assigned but its value is never used | |||||
int starting_spatial_dim = -1; | int starting_spatial_dim = -1; | ||||
#pragma warning restore CS0219 // Variable is assigned but its value is never used | |||||
if (!string.IsNullOrEmpty(data_format) && data_format.StartsWith("NC")) | if (!string.IsNullOrEmpty(data_format) && data_format.StartsWith("NC")) | ||||
starting_spatial_dim = 2; | starting_spatial_dim = 2; | ||||
else | else | ||||
@@ -152,7 +152,9 @@ namespace Tensorflow | |||||
{ | { | ||||
var _op = tf._op_def_lib._apply_op_helper("Switch", name, new { data, pred }); | var _op = tf._op_def_lib._apply_op_helper("Switch", name, new { data, pred }); | ||||
var _inputs_flat = _op.inputs; | var _inputs_flat = _op.inputs; | ||||
#pragma warning disable CS0219 // Variable is assigned but its value is never used | |||||
var _attrs = ("T", _op.get_attr("T")); | var _attrs = ("T", _op.get_attr("T")); | ||||
#pragma warning restore CS0219 // Variable is assigned but its value is never used | |||||
// TODO: missing original code | // TODO: missing original code | ||||
//_execute.record_gradient("Switch", _inputs_flat, _attrs, _result, name); | //_execute.record_gradient("Switch", _inputs_flat, _attrs, _result, name); | ||||
return new []{_op.outputs[0], _op.outputs[1]}; | return new []{_op.outputs[0], _op.outputs[1]}; | ||||
@@ -374,7 +374,9 @@ namespace Tensorflow | |||||
{ | { | ||||
// Scale loss if using a "mean" loss reduction and multiple replicas. | // Scale loss if using a "mean" loss reduction and multiple replicas. | ||||
loss = _scale_loss(loss); | loss = _scale_loss(loss); | ||||
#pragma warning disable CS0219 // Variable is assigned but its value is never used | |||||
int num_towers = 1; | int num_towers = 1; | ||||
#pragma warning restore CS0219 // Variable is assigned but its value is never used | |||||
if(var_list == null) | if(var_list == null) | ||||
{ | { | ||||
@@ -39,7 +39,9 @@ namespace Tensorflow.Train | |||||
VariableAggregation aggregation = VariableAggregation.None) | VariableAggregation aggregation = VariableAggregation.None) | ||||
{ | { | ||||
ops.init_scope(); | ops.init_scope(); | ||||
#pragma warning disable CS0219 // Variable is assigned but its value is never used | |||||
IInitializer checkpoint_initializer = null; | IInitializer checkpoint_initializer = null; | ||||
#pragma warning restore CS0219 // Variable is assigned but its value is never used | |||||
if (tf.context.executing_eagerly()) | if (tf.context.executing_eagerly()) | ||||
; | ; | ||||
else | else | ||||
@@ -167,7 +167,9 @@ namespace TensorFlowNET.UnitTest | |||||
{ | { | ||||
using (var sess = tf.Session()) | using (var sess = tf.Session()) | ||||
{ | { | ||||
#pragma warning disable CS0219 // Variable is assigned but its value is never used | |||||
Tensor t = null; | Tensor t = null; | ||||
#pragma warning restore CS0219 // Variable is assigned but its value is never used | |||||
for (int i = 0; i < 100; i++) | for (int i = 0; i < 100; i++) | ||||
{ | { | ||||
var v = (int*) Marshal.AllocHGlobal(sizeof(int)); | var v = (int*) Marshal.AllocHGlobal(sizeof(int)); | ||||