Browse Source

Suppress CS0642 (Possible mistaken empty statement)

tags/v0.20
Sam Harwell Haiping 5 years ago
parent
commit
48dfc92407
6 changed files with 18 additions and 0 deletions
  1. +6
    -0
      src/TensorFlowNET.Core/Eager/EagerRunner.TFE_FastPathExecute.cs
  2. +2
    -0
      src/TensorFlowNET.Core/Operations/OpDefLibrary.cs
  3. +4
    -0
      src/TensorFlowNET.Core/Tensors/tensor_util.cs
  4. +2
    -0
      src/TensorFlowNET.Core/Training/Saving/Saver.cs
  5. +2
    -0
      src/TensorFlowNET.Core/Training/Trackable.cs
  6. +2
    -0
      src/TensorFlowNET.Core/Variables/RefVariable.cs

+ 6
- 0
src/TensorFlowNET.Core/Eager/EagerRunner.TFE_FastPathExecute.cs View File

@@ -269,16 +269,22 @@ namespace Tensorflow.Eager
if(attr_value == null) if(attr_value == null)
{ {
if (is_list != 0) if (is_list != 0)
#pragma warning disable CS0642 // Possible mistaken empty statement
; ;
#pragma warning restore CS0642 // Possible mistaken empty statement
//SetOpAttrListDefault //SetOpAttrListDefault
else else
#pragma warning disable CS0642 // Possible mistaken empty statement
; ;
#pragma warning restore CS0642 // Possible mistaken empty statement
//SetOpAttrScalarDefault //SetOpAttrScalarDefault
} }
else else
{ {
if (is_list != 0) if (is_list != 0)
#pragma warning disable CS0642 // Possible mistaken empty statement
;// SetOpAttrList ;// SetOpAttrList
#pragma warning restore CS0642 // Possible mistaken empty statement
else else
SetOpAttrScalar(ctx, op, attr_name, attr_value, type, attr_list_sizes, status); SetOpAttrScalar(ctx, op, attr_name, attr_value, type, attr_list_sizes, status);
} }


+ 2
- 0
src/TensorFlowNET.Core/Operations/OpDefLibrary.cs View File

@@ -350,7 +350,9 @@ namespace Tensorflow
if (attr_def.Type.StartsWith("list(")) if (attr_def.Type.StartsWith("list("))
{ {
if (attr_def.HasMinimum) if (attr_def.HasMinimum)
#pragma warning disable CS0642 // Possible mistaken empty statement
; ;
#pragma warning restore CS0642 // Possible mistaken empty statement
attr_value.List = new AttrValue.Types.ListValue(); attr_value.List = new AttrValue.Types.ListValue();
} }




+ 4
- 0
src/TensorFlowNET.Core/Tensors/tensor_util.cs View File

@@ -71,9 +71,13 @@ namespace Tensorflow
return np.frombuffer(tensor.TensorContent.ToByteArray(), tensor_dtype).reshape(shape); return np.frombuffer(tensor.TensorContent.ToByteArray(), tensor_dtype).reshape(shape);
} }
else if (tensor.Dtype == DataType.DtHalf || tensor.Dtype == DataType.DtBfloat16) else if (tensor.Dtype == DataType.DtHalf || tensor.Dtype == DataType.DtBfloat16)
#pragma warning disable CS0642 // Possible mistaken empty statement
; ;
#pragma warning restore CS0642 // Possible mistaken empty statement
else if (tensor.Dtype == DataType.DtFloat) else if (tensor.Dtype == DataType.DtFloat)
#pragma warning disable CS0642 // Possible mistaken empty statement
; ;
#pragma warning restore CS0642 // Possible mistaken empty statement
else if (new DataType[] { DataType.DtInt32, DataType.DtUint8 }.Contains(tensor.Dtype)) else if (new DataType[] { DataType.DtInt32, DataType.DtUint8 }.Contains(tensor.Dtype))
{ {
if (tensor.IntVal.Count == 1) if (tensor.IntVal.Count == 1)


+ 2
- 0
src/TensorFlowNET.Core/Training/Saving/Saver.cs View File

@@ -241,7 +241,9 @@ namespace Tensorflow
Console.WriteLine($"Restoring parameters from {save_path}"); Console.WriteLine($"Restoring parameters from {save_path}");


if (tf.context.executing_eagerly()) if (tf.context.executing_eagerly())
#pragma warning disable CS0642 // Possible mistaken empty statement
; ;
#pragma warning restore CS0642 // Possible mistaken empty statement
else else
sess.run(_saver_def.RestoreOpName, sess.run(_saver_def.RestoreOpName,
new FeedItem(_saver_def.FilenameTensorName, save_path)); new FeedItem(_saver_def.FilenameTensorName, save_path));


+ 2
- 0
src/TensorFlowNET.Core/Training/Trackable.cs View File

@@ -43,7 +43,9 @@ namespace Tensorflow.Train
IInitializer checkpoint_initializer = null; IInitializer checkpoint_initializer = null;
#pragma warning restore CS0219 // Variable is assigned but its value is never used #pragma warning restore CS0219 // Variable is assigned but its value is never used
if (tf.context.executing_eagerly()) if (tf.context.executing_eagerly())
#pragma warning disable CS0642 // Possible mistaken empty statement
; ;
#pragma warning restore CS0642 // Possible mistaken empty statement
else else
checkpoint_initializer = null; checkpoint_initializer = null;




+ 2
- 0
src/TensorFlowNET.Core/Variables/RefVariable.cs View File

@@ -116,7 +116,9 @@ namespace Tensorflow
if (variable_def.SaveSliceInfoDef != null) if (variable_def.SaveSliceInfoDef != null)
throw new NotImplementedException("save_slice_info_def"); throw new NotImplementedException("save_slice_info_def");
else else
#pragma warning disable CS0642 // Possible mistaken empty statement
;// _save_slice_info = null; ;// _save_slice_info = null;
#pragma warning restore CS0642 // Possible mistaken empty statement


//_caching_device = null; //_caching_device = null;
//_constraint = null; //_constraint = null;


Loading…
Cancel
Save