diff options
author | Ivo Danihelka <ivo@danihelka.net> | 2015-02-06 15:19:03 +0300 |
---|---|---|
committer | Ivo Danihelka <ivo@danihelka.net> | 2015-02-06 15:19:03 +0300 |
commit | 29de241130eca61fa8af742eb925dfb96c6b97e3 (patch) | |
tree | b52f7700866033019d62e82cf33ad879a6396da7 | |
parent | df6162932c893f714d0a4e0535f903e0e4e4dab0 (diff) |
Displayed detected inf and -inf.
-rw-r--r-- | node.lua | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -89,6 +89,20 @@ function nnNode:graphNodeAttributes() end +local function getNanFlag(data) + local isNan = (data:ne(data):sum() > 0) + if isNan then + return 'NaN' + end + if data:max() == math.huge then + return 'inf' + end + if data:min() == -math.huge then + return '-inf' + end + return '' +end + function nnNode:label() local lbl = {} @@ -96,11 +110,7 @@ function nnNode:label() local function getstr(data) if not data then return '' end if istensor(data) then - local nanFlag = '' - local isNan = (data:ne(data):sum() > 0) - if isNan then - nanFlag = 'NaN' - end + local nanFlag = getNanFlag(data) return 'Tensor[' .. table.concat(data:size():totable(),'x') .. ']' .. nanFlag elseif istable(data) then local tstr = {} |