libcudnn related error after Ubuntu apt update

I got “ImportError of libcudnn.so.6” after Ubuntu apt update although I have no idea how apt update causes the error. The solution is re-install cuDNN.

Library files of cuDNN disappeared from a directory where is one of LD_LIBRARY_PATH. So, I just followed a guidance here.

  1. download cuDNN version 6.0
  2. copy the header and lib files as
    sudo cp include/cudnn.h /usr/local/cuda-8.0/include
    sudo cp lib64/lib* /usr/local/cuda-8.0/lib64/
  3. make symbolic links
    sudo chmod +r libcudnn.so.6.0.21
    sudo ln -sf libcudnn.so.6.0.21 libcudnn.so.6
    sudo ln -sf libcudnn.so.6 libcudnn.so
    sudo ldconfig

Keras install error with Anaconda 5.0.0 for Python 3.5.4

pip install keras” returns the following TypeError.

The solution found at StackOverflow says to
1. install html5lib by conda install –force html5lib
2. install keras by pip install keras


Keras: plot_model returns pydot and graphviz related error on Windows

plot_model of Keras installed on Windows may return pydot and graphviz related error like “Graphviz’s executables are not found’. The error cause is that the computer does not know the path of Graphviz’s executable exactly mentioned as the error message. The solution is explained here.

  1. Install GraphViz software not python module
  2. add GraphViz’s bin directory to system path
  3. install graphviz like conda install graphviz
  4. install pydot like pip install git+https://github.com/nlhepler/pydot.git





  1. Tensor
    1. 任意オーダーのtensorを定義する型
    2. Tutorialではオーダーが1,2のtensor(つまり,ベクトルと行列)のみを例として扱っている
    3. NumPyのArray型と互換性を持つ
  2. Autograd
    1. Tensorのあらゆる計算の勾配(微分)を自動で計算
    2. define-by-runのフレームワーク
      1. プログラムを走らせることで逆伝搬が定義される
      2. 毎回計算は異なる
    3. メインモジュールはautograd.Variable
  3. Neural Networks
    1. torch.nnモジュールによって定義
    2. 一般的な学習の流れ
      1. 学習可能なパラメータ(重み)を持つネットワークを定義
      2. 学習データセットに対して繰り返し計算
      3. ネットワークによって入力を処理
      4. 処理結果の誤差を評価
      5. ネットワークのパラメータに勾配を逆伝搬
      6. ネットワークの重みを更新
    3. Networkを表すclassを定義し,
      1. コンストラクタ(__init__)でネットワーク構成+活性化関数を定義
      2. 関数forwardで入力から出力までの処理を定義
      3. backwardはautogradにより自動で計算される
    4. 入力データはミニバッチのみをサポートしている
    5. 単一のデータを入力する時は,input.unsqueeze(0)によって次元数を増やす必要がある

PyGTK for Python 3.5 installation on Ubuntu 16.04 with anaconda

see here

conda install -c ska pygtk


Implementation: CycleGAN and Pix2pix

The implementation of CycleGAN and Pix2pix based on pytorch is published on github. Here’s a todo procedure with anaconda.

The CPU mode installation is under test right now…

  1. pytorch installation
    1. see the repository
    2. For a machine with GPU
      1. conda install -c conda-forge dominate
      2. conda install pytorch torchvision cuda80 -c soumith
    3. For a machine without GPU
      1. export enviroment variable NO_CUDA=1
      2. add anaconda root directory to CMAKE_PREFIX_PATH as
        export CMAKE_PREFIX_PATH=[anaconda root directory]
      3. conda install numpy pyyaml mkl setuptools cmake gcc cffi
      4. git clone https://github.com/pytorch/pytorch.git
      5. cd pytorch/
      6. python setup.py install
      7. cd ..
      8. git clone https://github.com/pytorch/vision.git
      9. cd vision
      10. python setup.py install
  2. CycleGAN and pix2pix installation
    1. conda install -c conda-forge dominate
    2. git clone https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix
    3. cd pytorch-CycleGAN-and-pix2pix

Note that running train.py and test.py without GPU requires to disable GPU via command line such as –gpu_id -1. For instance:
– With GPU: python train.py –dataroot ./datasets/facades –name facades_pix2pix –gpu_ids 0 –model pix2pix –align_data –which_direction BtoA
– Without GPU: python train.py –dataroot ./datasets/facades –name facades_pix2pix –gpu_ids -1 –model pix2pix –align_data –which_direction BtoA