https://github.com/atcold/torch-pretty-nn
Brings some colour to the boring `nn` package of Torch.
https://github.com/atcold/torch-pretty-nn
Last synced: 12 months ago
JSON representation
Brings some colour to the boring `nn` package of Torch.
- Host: GitHub
- URL: https://github.com/atcold/torch-pretty-nn
- Owner: Atcold
- Created: 2016-09-21T21:12:06.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-21T23:33:56.000Z (over 9 years ago)
- Last Synced: 2025-03-30T16:05:51.408Z (about 1 year ago)
- Language: Lua
- Size: 108 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pretty-nn
`pretty-nn` package brings some colour to the boring `nn` package of Torch.
## Installation
```
luarocks install pretty-nn
```
## Usage
Say we have the following model
```lua
c = nn.Parallel(1,2)
for i = 1, 3 do
local t = nn.Sequential()
t:add(nn.Linear(4, 2))
t:add(nn.Reshape(2, 1))
c:add(t)
end
split = nn.Concat(2)
split:add(c)
block = nn.Sequential()
block:add(nn.View(-1))
block:add(nn.Linear(12, 4))
block:add(nn.View(2, 2))
split:add(block)
```
If we print it on screen with `print(split)` we get something like this

If we `require 'pretty-nn'` and `print(split)` again, we'll get this

You can toggle the prettiness with `yourModelName:prettyPrint()`.
Alternative, you can *enable / disable* it by `yourModelName:prettyPrint(true / false)`.