diff options
author | koray kavukcuoglu <koray@kavukcuoglu.org> | 2015-02-07 04:49:08 +0300 |
---|---|---|
committer | koray kavukcuoglu <koray@kavukcuoglu.org> | 2015-02-07 04:49:08 +0300 |
commit | 3b97d427f11204b5d32e19f53ea9cdd04cc6af6b (patch) | |
tree | b52f7700866033019d62e82cf33ad879a6396da7 | |
parent | df6162932c893f714d0a4e0535f903e0e4e4dab0 (diff) | |
parent | 29de241130eca61fa8af742eb925dfb96c6b97e3 (diff) |
Merge pull request #39 from fidlej/topic_inf
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 = {} |