Skip to content

← deep_learning package

NetDefine

Define a neural network module (subnet).

A subnet is a portion of a neural network that contains implicit parameters that are optimized during training. A subnet may also contain instances of other subnets. The easiest way to use a subnet is to wire its "this" output into a DeepModel node, which can be used like any other machine-learning node as part of a data pipeline (e.g., for classification or regression). The normally implicit parameters of a subnet can also be managed explicitly and by hand by invoking the subnet's initialize function (by wiring it into the Call node) to obtain an initial set of parameters, and then passing the parameters into the subnet's forward function (again by wiring it into the Call node) to compute the outputs of the subnet. Typically one would then apply the the Calculate Gradient node to the forward function to obtain a function that yields gradients, invoke the resulting gradient function given some data and parameters, and then use the resulting gradients to update the parameters (i.e., performing gradient descent). This node is used by wiring a subgraph into its graph port. The subgraph must contain one or more Placeholder nodes for the network inputs, and the network signature must name all the placeholders in some order, which is in the "Network [signature]" (or network__signature in code) port. Version 0.2.0

Ports/Properties

network

Graph that defines the network.

  • verbose name: Network
  • default value: None
  • port type: GraphPort
  • value type: Graph

network__signature

Optional argument names of the network being defined. Your network is specified as a graph with one placeholder node for each argument name specified here (whose slotname must match that argument name). Those placeholders then feed into any number of neural network or other mathematical operations, and the final output of your network is wired into the "network" input of the NetDefine node. This is analogous to the Function Declaration node that defines a function of some arguments in a similar manner. Note that in graphical UIs, the edge that goes into the "network" input will be drawn in dotted style to indicate that this is not normal forward data flow, but that a graph (here your network definition) is being passed verbatim to the NetDefine node.

  • verbose name: Network [Inputs]
  • default value: (input)
  • port type: Port
  • value type: object (can be None)

netname

Name of the network module. This name is inherited by the parameters of the network and can be used to group parameters logically. When the network is materialized (instantiated) multiple times, the name will be suffixed with a number.

  • verbose name: Name
  • default value: mynetwork
  • port type: StringPort
  • value type: str (can be None)

desc

Description of the function. The first sentence is taken as the executive summary and should not exceed 60 characters). The next paragraph is the essential description, and any following paragraphs are considered additional description text. This should not list the arguments, but can give a high-level overview of what the network can accept and what it does. It is possible to use limited amounts of HTML formatting, for instance for emphasis.

  • verbose name: Description
  • default value: None
  • port type: StringPort
  • value type: str (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

  • verbose name: Set Breakpoint (Debug Only)
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

  • verbose name: Metadata
  • default value: {}
  • port type: DictPort
  • value type: dict (can be None)