Hello, I try to install Keras with backend Theano on my PC.
After I run the MNIST example code, "AssertionError: Inf detected / Big 
value detected" will show.
I'm not sure why this happen, maybe it's some of the library is conflict?
Could you guys help me? Thank you so much!

1. MNIST example code:
https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py

2. Environment:
Theano version: 0.8.2

   Config:

[global]

openmp=False 

device=cpu

optimizer = None

mode=NanGuardMode

exception_verbosity=high 

 
Keras version: 1.1.0 
           Config:

{

    "image_dim_ordering": "th", 

    "epsilon": 1e-07, 

    "floatx": "float32", 

    "backend": "theano"

}


Python environment: 

Python 2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jun 29 2016, 11:07:13) 
[MSC v.
1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org


3. Error code:
Using Theano backend.
Downloading data from https://s3.amazonaws.com/img-datasets/mnist.pkl.gz
14958592/15296311 [============================>.] - ETA: 0sX_train shape: 
(6000
0L, 1L, 28L, 28L)
60000 train samples
10000 test samples
Train on 60000 samples, validate on 10000 samples
Epoch 1/12
Traceback (most recent call last):
  File "mnist_cnn.py", line 78, in <module>
    verbose=1, validation_data=(X_test, Y_test))
  File "C:\Anaconda2\lib\site-packages\keras\models.py", line 620, in fit
    sample_weight=sample_weight)
  File "C:\Anaconda2\lib\site-packages\keras\engine\training.py", line 
1106, in
fit
    callback_metrics=callback_metrics)
  File "C:\Anaconda2\lib\site-packages\keras\engine\training.py", line 824, 
in _
fit_loop
    outs = f(ins_batch)
  File "C:\Anaconda2\lib\site-packages\keras\backend\theano_backend.py", 
line 71
7, in __call__
    return self.function(*inputs)
  File "C:\Anaconda2\lib\site-packages\theano\compile\function_module.py", 
line
859, in __call__
    outputs = self.fn()
  File "C:\Anaconda2\lib\site-packages\theano\gof\link.py", line 1014, in f
    raise_with_op(node, *thunks)
  File "C:\Anaconda2\lib\site-packages\theano\gof\link.py", line 314, in 
raise_w
ith_op
    reraise(exc_type, exc_value, exc_trace)
  File "C:\Anaconda2\lib\site-packages\theano\gof\link.py", line 1012, in f
    wrapper(i, node, *thunks)
  File "C:\Anaconda2\lib\site-packages\theano\compile\nanguardmode.py", 
line 302
, in nan_check
    do_check_on(x[0], node, fn, True)
  File "C:\Anaconda2\lib\site-packages\theano\compile\nanguardmode.py", 
line 272
, in do_check_on
    raise AssertionError(msg)
AssertionError: Inf detected
Big value detected
NanGuardMode found an error in an input of this node.
Node:
DimShuffle{x}(TensorConstant{inf})
The input variable that cause problem:
DimShuffle{x} [id A] ''
 |TensorConstant{inf} [id B]


Apply node that caused the error: DimShuffle{x}(TensorConstant{inf})
Toposort index: 0
Inputs types: [TensorType(float32, scalar)]
Inputs shapes: [()]
Inputs strides: [()]
Inputs values: [array(inf, dtype=float32)]
Outputs clients: [[Elemwise{clip,no_inplace}(Elemwise{add,no_inplace}.0, 
DimShuf
fle{x}.0, DimShuffle{x}.0)]]

Backtrace when the node is created(use Theano flag traceback.limit=N to 
make it
longer):
  File "mnist_cnn.py", line 78, in <module>
    verbose=1, validation_data=(X_test, Y_test))
  File "C:\Anaconda2\lib\site-packages\keras\models.py", line 620, in fit
    sample_weight=sample_weight)
  File "C:\Anaconda2\lib\site-packages\keras\engine\training.py", line 
1079, in
fit
    self._make_train_function()
  File "C:\Anaconda2\lib\site-packages\keras\engine\training.py", line 696, 
in _
make_train_function
    self.total_loss)
  File "C:\Anaconda2\lib\site-packages\keras\optimizers.py", line 332, in 
get_up
dates
    update = g * K.sqrt(d_a + self.epsilon) / K.sqrt(new_a + self.epsilon)
  File "C:\Anaconda2\lib\site-packages\keras\backend\theano_backend.py", 
line 32
4, in sqrt
    x = T.clip(x, 0., np.inf)

Debugprint of the apply node:
DimShuffle{x} [id A] <TensorType(float32, (True,))> ''
 |TensorConstant{inf} [id B] <TensorType(float32, scalar)>

HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and 
storag
e map footprint of this apply node.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to