Package dimer :: Package nnet :: Class Layer
[hide private]
[frames] | no frames]

Class Layer

source code

object --+
         |
        Layer
Known Subclasses:

abstract layer class.

A layer is a list of weights. Weights are theano shared tensors that are needed for example to compute activation. You can use them also for other reasons e.g., speeds to implement momentum GSD.

Nested Classes [hide private]
  __metaclass__
Metaclass for defining Abstract Base Classes (ABCs).
Instance Methods [hide private]
 
__init__(self, wshape_lst, wnames, fanin_lst, rng, wdtype)
initialize by the given weight properties, all params are lists of the same length
source code
 
activation(self)
the symbolic activation function
source code
 
get_flat_weights(self)
get a list of the flattened version of the weights of this layer
source code
 
get_params(self)
weights as symbolic variables
source code
 
get_weights(self)
weights as ndarrays
source code
 
load_flat_weights(self, flatp)
reshape the given flattened weights into the correct dimensions for this layer
source code
 
set_params(self, params)
set weights
source code
 
set_weights(self, vlst)
set the weight values of this layer
source code
 
weight_norm(self, degree)
compute the L1 or L2 norm of weights
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __abstractmethods__ = frozenset(['activation', 'get_params', '...
  _abc_cache = <_weakrefset.WeakSet object at 0x10dded250>
  _abc_negative_cache = <_weakrefset.WeakSet object at 0x10dded290>
  _abc_negative_cache_version = 23
  _abc_registry = <_weakrefset.WeakSet object at 0x10ddd2790>
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, wshape_lst, wnames, fanin_lst, rng, wdtype)
(Constructor)

source code 

initialize by the given weight properties, all params are lists of the same length

Parameters:
  • wshape_lst - shapes of weights
  • wnames - names of weights
  • fanin_lst - fan in of weights
  • rng - a random number generator or init value (see alloc_shared_weights_)
  • wdtype - data type of weights.
Overrides: object.__init__

get_flat_weights(self)

source code 

get a list of the flattened version of the weights of this layer

Returns:
list[ndarray]

load_flat_weights(self, flatp)

source code 

reshape the given flattened weights into the correct dimensions for this layer

Parameters:
  • flatp - flattened weights (list[ndarray])
Returns:
the same given weights reshaped

set_params(self, params)

source code 

set weights

Parameters:
  • params - tuple of (ndarray) @return none

weight_norm(self, degree)

source code 

compute the L1 or L2 norm of weights

Parameters:
  • degree - keyword `l1` or `l2`
Returns:
the L1 or L2 norm of weights (float)

Class Variable Details [hide private]

__abstractmethods__

Value:
frozenset(['activation', 'get_params', 'set_params'])