torch / gnuplot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NaN behaviour

cfedk opened this issue · comments

commented

There is inconsistent behaviour when plotting NaN values vs Inf values:

require 'gnuplot'
a=torch.rand(5)
a[2] = 0/0
a[4] = 1/0
gnuplot.plot(a)
gnuplot.axis({0,5,0,2})

This produces the following:

untitled

The item at a[4] (Inf) is not drawn. That's great. However, the item at a[2] (NaN) is drawn - but at x=1. When plotting any NaN value a[i]=NaN, this will be plotted as (x,y) = (i-1,i), which is weird.

Of course this is not a major problem - let's concentrate on fixing the code that's producing NaN! - but it is an oddity to be aware of I think. Perhaps this is well known behaviour in gnuplot, though.