This function checks, for all units in net, if the fields of the UNIT
structure have valid values.
Checks include: LayerId should be 0 or positive; InOutIndex should be
0 or positive; UnitName should not be an empty string; Theta.Next should
not be NULL;ActFunc,TransFunc and DerTransFunc should not be NULL
for non-input units; NumInLinks and NumOutLinks should be positive for
non-input units; and InLinks and OutLinks should not be NULL for non-input
units.
Finally, the total number of units, input units and output units is counted
and compared to the net fields NumUnits,NumInputs and NumOutputs.