Skip to content

Commit fe62586

Browse files
sharwellOceania2018
authored andcommitted
Suppress CS0162 (Unreachable code detected)
1 parent 48dfc92 commit fe62586

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/TensorFlowNET.Core/Gradients/math_grad.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ public static Tensor[] _MeanGrad(Operation op, Tensor[] grads)
341341
var output_shape_tensor = array_ops.shape(op.outputs[0]);
342342
var factor = _safe_shape_div(math_ops.reduce_prod(input_shape_tensor), math_ops.reduce_prod(output_shape_tensor));
343343
throw new NotImplementedException("");
344+
#pragma warning disable CS0162 // Unreachable code detected
344345
factor_tensor = null;
346+
#pragma warning restore CS0162 // Unreachable code detected
345347
}
346348

347349
result = math_ops.truediv(sum_grad, math_ops.cast(factor_tensor, sum_grad.dtype));

src/TensorFlowNET.Core/Keras/Sequence.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public NDArray pad_sequences(NDArray sequences,
5050
value = 0f;
5151

5252
var nd = new NDArray(np.int32, new Shape(sequences.size, maxlen.Value));
53+
#pragma warning disable CS0162 // Unreachable code detected
5354
for (int i = 0; i < nd.shape[0]; i++)
55+
#pragma warning restore CS0162 // Unreachable code detected
5456
{
5557
switch(sequences[i])
5658
{

src/TensorFlowNET.Core/Sessions/BaseSession.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ private static unsafe NDArray fetchValue(IntPtr output)
422422
{
423423
throw new NotImplementedException();
424424
//TODO:! This is not the way to handle string[], it should be done with TF_DecodeString
425+
#pragma warning disable CS0162 // Unreachable code detected
425426
using (var reader = new CodedInputStream(new IntPtr(srcAddress).Stream(8, (long) tensor.bytesize)))
427+
#pragma warning restore CS0162 // Unreachable code detected
426428
ret = NDArray.FromString(reader.ReadString());
427429
break;
428430
}

0 commit comments

Comments
 (0)