Code Monkey home page Code Monkey logo

nnname's Introduction

nnname

Naming features for Torch nn modules

Installation

luarock install nnname

Usage

nnname adds find() findAll() setName() methods to nn.Module, so please require nn and dpnn (optional) before nnname as follows. Also, it rewrites the __string() function to show module name. The name of a module is store at .name variable.

require 'nn'
require 'dpnn' -- optional
require 'nnname'

API

[nn.Module] setName(name)

It sets the name of the module to name and return the module.

[nn.Module] find(name, last)

It returns the first nn.Module whose name is name in the nn.Container by default. It returns the last module with that specific name when last is true.

[table] findAll(name)

It returns a table of modules in the nn.Container whose name is name.

Example

model = nn.Sequential():setName('net')
    :add(nn.Linear(10, 4):setName('linear'))
    :add(nn.ReLU(true):setName('relu_1'))
    :add(nn.Linear(4, 1):setName('linear'))
    :add(nn.Sigmoid(true):setName('Sigmoid'))

relu = model:find('relu_1') -- get the module with name 'relu_1'

linears = model:findAll('linear') -- get a table of modules with name 'linear'

nnname's People

Contributors

felixgwu avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.