Module Expr Str Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults kwarg body Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call NameLoad Assign NameStore ListComp AttributeLoad NameLoad attr comprehension NameStore NameLoad UnaryOpNot BoolOpOr CompareIn AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AugAssignAdd NameStore Call AttributeLoad NameLoad attr Str ListLoad Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr keyword NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg body Assign NameStore NameLoad For NameStore AttributeLoad NameLoad attr body Assign NameStore Call NameLoad Call NameLoad NameLoad Assign NameStore NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Return AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Return AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr decorator_list Call AttributeLoad NameLoad attr Str decorator_list ClassDef bases NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Return AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore SubscriptLoad AttributeLoad NameLoad attr Index Num attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Return AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore SubscriptLoad AttributeLoad NameLoad attr Index Num attr NameLoad decorator_list AttributeLoad NameLoad attr decorator_list ClassDef bases NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad kwarg body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr IfExp CompareIs NameLoad NameLoad Call NameLoad NameLoad Assign AttributeStore NameLoad attr ListLoad For NameStore Call NameLoad Call NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr attr Assign AttributeStore NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore ListLoad For NameStore Call NameLoad ListLoad AttributeLoad NameLoad attr NameLoad body If CompareIs NameLoad NameLoad body Continue If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot NameLoad body Assign NameStore BinOpMult ListLoad NameLoad BinOpAdd Call NameLoad NameLoad Num Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list Call NameLoad keyword ListLoad Str FunctionDef arguments args NameParam defaults body Return SubscriptLoad AttributeLoad NameLoad attr Index Num decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Num NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Return SubscriptLoad AttributeLoad NameLoad attr Index Num decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Num NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body If UnaryOpNot CompareEq BinOpSub Call NameLoad AttributeLoad NameLoad attr Num Call NameLoad AttributeLoad NameLoad attr body Raise NameLoad For TupleStore NameStore NameStore NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Slice Num SubscriptLoad AttributeLoad NameLoad attr Slice Num AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If CompareIsNot Call NameLoad NameLoad Str NameLoad NameLoad body Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A Bricks that compose together other bricks in linear sequences. N/A copy toolz interleave picklable_itertools.extras equizip utils pack base Brick application lazy interfaces Feedforward Initializable simple Linear Sequence N/A Brick N/A N/A A sequence of bricks.

    This brick applies a sequence of bricks, assuming that their in- and
    outputs are compatible.

    Parameters
    ----------
    application_methods : list
        List of :class:`.BoundApplication` to apply

     __init__ N/A N/A self application_methods N/A kwargs N/A N/A N/A self application_methods application_methods N/A seen N/A set N/A children N/A N/A app brick N/A app application_methods N/A N/A N/A N/A app brick seen N/A N/A seen add N/A app brick N/A children N/A N/A kwargs get children N/A N/A N/A N/A N/A super Sequence self __init__ children children kwargs N/A apply N/A N/A self N/A args N/A N/A child_input args N/A application_method N/A self application_methods N/A N/A output N/A application_method N/A pack child_input N/A child_input output N/A output N/A application apply_inputs N/A N/A self N/A N/A N/A N/A N/A N/A self application_methods N/A 0 inputs N/A N/A N/A apply property inputs apply_outputs N/A N/A self N/A N/A N/A N/A N/A N/A self application_methods N/A -1 outputs N/A N/A N/A apply property outputs N/A FeedforwardSequence N/A Sequence Feedforward N/A N/A A sequence where the first and last bricks are feedforward.

    Parameters
    ----------
    application_methods : list
        List of :class:`.BoundApplication` to apply. The first and last
        application method should belong to a :class:`Feedforward` brick.

     input_dim N/A N/A self N/A N/A N/A N/A N/A N/A self children N/A 0 input_dim N/A property input_dim N/A N/A self value N/A N/A N/A N/A N/A N/A self children N/A 0 input_dim value N/A N/A input_dim setter output_dim N/A N/A self N/A N/A N/A N/A N/A N/A self children N/A -1 output_dim N/A property output_dim N/A N/A self value N/A N/A N/A N/A N/A N/A self children N/A -1 output_dim value N/A N/A output_dim setter N/A MLP N/A FeedforwardSequence Initializable N/A N/A A simple multi-layer perceptron.

    Parameters
    ----------
    activations : list of :class:`.Brick`, :class:`.BoundApplication`,
                  or ``None``
        A list of activations to apply after each linear transformation.
        Give ``None`` to not apply any activation. It is assumed that the
        application method to use is ``apply``. Required for
        :meth:`__init__`.
    dims : list of ints
        A list of input dimensions, as well as the output dimension of the
        last layer. Required for :meth:`~.Brick.allocate`.
    prototype : :class:`.Brick`, optional
        The transformation prototype. A copy will be created for every
        activation. If not provided, an instance of :class:`~simple.Linear`
        will be used.

    Notes
    -----
    See :class:`Initializable` for initialization parameters.

    Note that the ``weights_init``, ``biases_init`` (as well as
    ``use_bias`` if set to a value other than the default of ``None``)
    configurations will overwrite those of the layers each time the
    :class:`MLP` is re-initialized. For more fine-grained control, push the
    configuration to the child layers manually before initialization.

    >>> from blocks.bricks import Tanh
    >>> from blocks.initialization import IsotropicGaussian, Constant
    >>> mlp = MLP(activations=[Tanh(), None], dims=[30, 20, 10],
    ...           weights_init=IsotropicGaussian(),
    ...           biases_init=Constant(1))
    >>> mlp.push_initialization_config()  # Configure children
    >>> mlp.children[0].weights_init = IsotropicGaussian(0.1)
    >>> mlp.initialize()

     __init__ N/A N/A self activations dims prototype N/A None kwargs N/A N/A N/A self activations activations N/A N/A self prototype N/A N/A prototype None N/A Linear prototype N/A N/A self linear_transformations N/A N/A i N/A range N/A len activations N/A N/A linear N/A N/A copy deepcopy N/A self prototype N/A name N/A N/A N/A N/A N/A self prototype __class__ __name__ lower N/A N/A linear name N/A N/A {}_{} format name i N/A N/A N/A N/A self linear_transformations append linear N/A application_methods N/A N/A entity N/A interleave N/A N/A self linear_transformations activations N/A N/A N/A entity None N/A N/A N/A N/A isinstance entity Brick N/A N/A N/A N/A application_methods append N/A entity apply N/A N/A N/A N/A application_methods append entity N/A N/A dims N/A N/A dims N/A N/A None N/A N/A len activations 1 N/A N/A self dims dims N/A N/A N/A N/A super MLP self __init__ application_methods kwargs N/A N/A lazy allocation N/A dims input_dim N/A N/A self N/A N/A N/A N/A N/A self dims N/A 0 N/A property input_dim N/A N/A self value N/A N/A N/A N/A N/A self dims N/A 0 value N/A N/A input_dim setter output_dim N/A N/A self N/A N/A N/A N/A N/A self dims N/A -1 N/A property output_dim N/A N/A self value N/A N/A N/A N/A N/A self dims N/A -1 value N/A N/A output_dim setter _push_allocation_config N/A N/A self N/A N/A N/A N/A N/A N/A N/A len N/A self dims 1 N/A len N/A self linear_transformations N/A N/A ValueError N/A N/A input_dim output_dim layer N/A equizip N/A N/A self dims N/A -1 N/A N/A self dims N/A 1 N/A self linear_transformations N/A N/A N/A layer input_dim input_dim N/A N/A layer output_dim output_dim N/A N/A N/A getattr self use_bias None None N/A N/A N/A layer use_bias N/A self use_bias N/A N/A