Skip to content

Visual Neural Network Language

Brian Broll edited this page Oct 4, 2016 · 2 revisions

The architecture editor supports the creation of neural networks using visual layers. These visual layers represent layers defined in torch as well as other user defined custom layers. This page discusses how the visual representation is automatically generated from the layer's definition in torch.

Overview

In both cases, the visual representation of the layer (ie, name, attributes, attribute types) is determined by parsing the layer definition for the layer's attributes and relevant information. "Layer attributes" refers to configurable parameters for a given layer. This is done through constructor arguments and detecting setter methods (such as ceil in SpatialMaxPooling). That is, we build an abstract syntax tree of the layer definition then walk the tree and discover the relevant structures to determine:

  • constructor arguments
  • setter methods
  • default values
  • types of the layer's attributes

The first two bullet points represent configurable layer attributes. These attributes are then added to the visual layer in deepforge to be configured from the architecture editor. Knowing the default values helps the architecture editor provide visual cues as to the unset values (as opposed to simply stating ); default values also provide a method of inferring the default values for the layer attributes as the type should match the type of the default value. More importantly, type inference allows the user interface to appropriately allow users to add layers as arguments as arguments that are layers behave differently than other types. That is, boolean, numbers, strings, etc, can all be added as text fields to a visual layer whereas a layer argument requires the user to be able to compose nested architectures using the visual interface (rather than simply inputting values to a text field).

The interfaces for the nn package and the rnn package can be found in src/plugins/CreateTorchMeta/schemas. These can be generated by running the following command from the project root:

npm run build-nn

The modular layer parsing logic is defined in a static class called LayerParser and can be found in src/common/LayerParser.js.

Clone this wiki locally