Skip to content

← deep_learning package

ChainedStep

Compose a sequence of gradient processing steps into a single update step.

This can be used to build either custom optimizers or to augment existing optimizer steps with additional steps (e.g. gradient clipping). IMPORTANT: note that, by convention, a full end-to-end optimizer step (e.g., as implemented by AdamStep) negates the gradient before returning it, yielding an additive weight update, so that it can be applied to weights using the Add node. Therefore, when you build a custom optimizer from raw gradient processing steps, you need to include a negation step (scale by -1) near or at the end of the chain so as to obtain a full end-to-end optimizer step that is swappable with other optimizers. If your chain includes one of the end-to-end steps (which already do the negation), however, this will not be necessary. The scaling typically happens last (usually implemented using ScalingStep, which additionally can also take a learning rate), unless you are also using a ConstraintStep, in which case that must be the last step in the chain. Tip: Almost all canonical end-to-end optimizers (those that are not described as chainable, e.g., AdamStep, RMSPropStep, etc.), consist of a core gradient scaling rule followed by optional additional steps such as weight decay, momentum, scaling by a learning rate (schedule), etc. and generally a negation. For some optimizers, the core rule is available as a separate node, but for others, it is not -- for these optimizers, you can generally obtain a step analogous to the core scaling rule by setting the learning rate to -1.0 and disabling all optional features of the optimizer (like momentum, weight decay, etc). This rule can then be combined with other steps in a sensible order and a final negation to form a customized optimizer. Version 0.2.0

Ports/Properties

gradients

Gradients to be transformed.

verbose name
Gradients
default value
None
port type
DataPort
value type
object (can be None)
data direction
INOUT

weights

Optional current weights.

verbose name
Weights
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

state

Explicit state of the node.

verbose name
State
default value
None
port type
DataPort
value type
object (can be None)
data direction
INOUT

step1

Step 1.

verbose name
Step1
default value
None
port type
DataPort
value type
BaseNode (can be None)
data direction
IN

step2

Step 2.

verbose name
Step2
default value
None
port type
DataPort
value type
BaseNode (can be None)
data direction
IN

step3

Step 3.

verbose name
Step3
default value
None
port type
DataPort
value type
BaseNode (can be None)
data direction
IN

step4

Step 4.

verbose name
Step4
default value
None
port type
DataPort
value type
BaseNode (can be None)
data direction
IN

step5

Step 5.

verbose name
Step5
default value
None
port type
DataPort
value type
BaseNode (can be None)
data direction
IN

step6

Step 6.

verbose name
Step6
default value
None
port type
DataPort
value type
BaseNode (can be None)
data direction
IN

step7

Step 7.

verbose name
Step7
default value
None
port type
DataPort
value type
BaseNode (can be None)
data direction
IN

step8

Step 8.

verbose name
Step8
default value
None
port type
DataPort
value type
BaseNode (can be None)
data direction
IN

step9

Step 9.

verbose name
Step9
default value
None
port type
DataPort
value type
BaseNode (can be None)
data direction
IN

step0

Step 0.

verbose name
Step0
default value
None
port type
DataPort
value type
BaseNode (can be None)
data direction
IN

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)