https://github.com/mitmul/ofchainer
https://github.com/mitmul/ofchainer
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/mitmul/ofchainer
- Owner: mitmul
- License: mit
- Created: 2016-12-07T17:17:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-04-11T08:22:30.000Z (about 7 years ago)
- Last Synced: 2025-03-25T03:41:39.300Z (about 1 year ago)
- Language: Python
- Size: 7.81 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 1f-Chainer
One file Chainer
## About One-file Chainer
- Core functionalities of Chainer are implemented in 1 file
- Only Linear, ReLU, MeanSquaredError and SGD are available
- You can run "mnist.py" to make sure that it can train a 3-layers perceptron for classifying MNIST
- 1 hot feature:
- You can switch all computations to GPU-mode by just replacing `import numpy as xp` with `import cupy as xp` found in the top of the file "chainer.py"
## MNIST Training example
### Run on CPU
- Just run `mnist.py`
```
python mnist.py
```
### Run on GPU
- Replace `import numpy as xp` with `import cupy as xp` in `chainer.py`
- Then, run `mnist.py` with an option `--gpu 0`
```
python mnist.py --gpu 0
```
## minimum.py?
"minimum.py" in this repository is another implementation example of 3-layers perceptron for MNIST. It contains
- Linear
- ReLU
- Softmax cross entropy (grad)
- Training code for MNIST
- Accuracy calculation
in **just 74 lines**. ("chainer.py" have 205 lines)
Try:
```
python minimum.py
```