Mostafa-Samir / DNC-tensorflow

A TensorFlow implementation of DeepMind's Differential Neural Computers (DNC)
MIT License
581 stars 164 forks source link

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices #17

Closed SeekPoint closed 7 years ago

SeekPoint commented 7 years ago

(venv) mldl@mldlUB1604:~/ub16_prj/DNC-tensorflow/tasks/babi$ (venv) mldl@mldlUB1604:~/ub16_prj/DNC-tensorflow/tasks/babi$ CUDA_VISIBLE_DEVICES=-1 python train.py --iterations=500005 I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally Loading Data ... Done! E tensorflow/stream_executor/cuda/cuda_driver.cc:491] failed call to cuInit: CUDA_ERROR_NO_DEVICE I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:153] retrieving CUDA diagnostic information for host: mldlUB1604 I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:160] hostname: mldlUB1604 I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:185] libcuda reported version is: 367.57.0 I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:356] driver version file contents: """NVRM version: NVIDIA UNIX x86_64 Kernel Module 367.57 Mon Oct 3 20:37:01 PDT 2016 GCC version: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) """ I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] kernel reported version is: 367.57.0 I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:293] kernel version seems to match DSO: 367.57.0 Building Computational Graph ... Done! Initializing Variables ... Done! Iteration 0/500006Traceback (most recent call last): File "train.py", line 157, in input_data, target_output, seq_len, weights = prepare_sample(sample, lexicon_dict['-'], word_space_size) File "train.py", line 37, in prepare_sample input_vec = np.array([onehot(code, word_space_size) for code in input_vec]) File "train.py", line 24, in onehot vec[index] = 1.0 IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices (venv) mldl@mldlUB1604:~/ub16_prj/DNC-tensorflow/tasks/babi$

ChinHui-Chen commented 7 years ago

find vec assignment in def onehot(index, size): function

and replace vec[index] = 1.0 with vec[int(index)] = 1.0

SeekPoint commented 7 years ago

thanks , it works .