help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Using keyboard command for debugging


From: syed khalid
Subject: Fwd: Using keyboard command for debugging
Date: Mon, 3 Feb 2014 19:57:44 -1000


Re
showtrainprogress: invalid conversion from NaN to logical
error: called from:
error:   /home/syedk/OCT/nnet/tests/MLP/__trainlm.m at line 303, column 5




Hello Philip
   Thank you very much for your response about my question shown below. I did insert the "keyboard" command on line 302. Am using "disp" to show the variables. However, am a bit of a loss as to what and how to display the variables. Here is the code
>>>
function showtrainprogress(show,stop,iEpochs,epochs,time,currentTime, \
          goal,perf,minGrad,normGradX,shortStr,net)

    ## check number of inputs
    error(nargchk(12,12,nargin));
keyboard

## show progress
    if isfinite(show) & (!rem(iEpochs,show) | length(stop))
      fprintf(shortStr);   # outputs the training algorithm
      if isfinite(epochs)
        fprintf(", Epoch %g/%g",iEpochs, epochs);
      endif
      if isfinite(time)
        fprintf(", Time %4.1f%%",currentTime/time*100);   # \todo: Time
>>>>

I tried a few debug disp commands
debug> disp (iEpochs)
0
debug> disp (epochs)
 100
debug>

You indicated rem() might be the culprit. I am having bridging the gap as to what to do next. Should I try to display    !rem(iEpochs,show) | length(stop) ??


Well, insert a keyboard statement in empty line 302 and run your code.
The code will stop at the keyboard statement in a debug prompt and you can inspect the values of the three logical clauses making up your if statement. At least one of them must be wrong.
Once you know those values you can start reconstructing how they were assigned that value.

Looking cursory at L.304 and the error message I have a gut feeling that it is the rem() call (the result of which is being converted to logical through the ! exclamation mark) that has problems, e.g., operand iEpoch not being finite.


_____________________________________
Sent from http://octave.1599824.n4.nabble.com




--
Syed Khalid
 
CEO
 
Pacific Cloud
 
1-408-655-1096

reply via email to

[Prev in Thread] Current Thread [Next in Thread]