-2

What is assert(false) doing in the following code?

public float[] evaluate(float[] inputs)
{
    // propagate the inputs through all neural network
    // and return the outputs
    assert(false);

    float outputs[] = new float[inputs.length];

    for( int i = 0; i < _layers.size(); ++i ) {  
        outputs = _layers.get(i).evaluate(inputs);
        inputs = outputs;
    }

    return outputs;
}
Tunaki
  • 132,869
  • 46
  • 340
  • 423
user366312
  • 16,949
  • 65
  • 235
  • 452
  • See also http://stackoverflow.com/questions/28480068/assertfalse-vs-runtimeexception and http://stackoverflow.com/questions/36468020/is-assert-false-a-good-practice – Tunaki Dec 03 '16 at 21:01

1 Answers1

1

The line, as it is, only checks that asserations are not enabled, otherwise throw an AsserationError. As you can add an message like

assert false: "nope!";

there is no equivalent in c#. Also it is in java a keyword but not in c#.

Grim
  • 1,938
  • 10
  • 56
  • 123