abstract - abstraction class

The file yann.layers.abstract.py contains the definition for the abstract layer:

Todo

  • LSTM / GRN layers
  • An Embed layer that is going to create a new embedding space for two layer’s activations to project on to the same space and minimize its distances.
class yann.layers.abstract.layer(id, type, verbose=2)[source]

Prototype for what a layer should look like. Every layer should inherit from this. This is a template class do not use this directly, you need to use a specific type of layer which again will be called by yann.network.network.add_layer

Parameters:
  • id – String
  • origin – String id
  • type – string- 'classifier', 'dot-product', 'objective', 'conv_pool', 'input' .. .

Notes

Use self.type, self.origin, self.destination``, self.output, self.inference
self.output_shape for outside calls and purposes.
get_params(borrow=True, verbose=2)[source]

This method returns the parameters of the layer in a numpy ndarray format.

Parameters:
  • borrow – Theano borrow, default is True.
  • verbose – As always

Notes

This is a slow method, because we are taking the values out of GPU. Ordinarily, I should have used get_value( borrow = True ), but I can’t do this because some parameters are theano.tensor.var.TensorVariable which needs to be run through eval.

print_layer(prefix=' ', nest=True, last=True, verbose=2)[source]

Print information about the layer

Parameters:
  • nest – If True will print the tree from here on. If False it will print only this layer.
  • prefix – Is what prefix you want to add to the network print command.