Layer.py 1.13 KB
Newer Older
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
1 2 3 4 5
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# @author: Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
# @date: Wed 11 May 2016 17:38 CEST

6
import tensorflow as tf
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
7 8 9 10 11 12 13 14


class Layer(object):

    """
    Layer base class
    """

15
    def __init__(self, name, activation=None, initialization='xavier', use_gpu=False, seed=10):
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
16 17 18 19
        """
        Base constructor

        **Parameters**
20 21 22 23 24
          name: Name of the layer
          activation: Tensorflow activation operation (https://www.tensorflow.org/versions/r0.10/api_docs/python/nn.html)
          initialization: STILL TO BE DONE.
          use_gpu: I think this is not necessary to explain
          seed: Initialization seed set in Tensor flow
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
25
        """
26
        self.name = name
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
27 28 29 30
        self.initialization = initialization
        self.use_gpu = use_gpu
        self.seed = seed

Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
31 32
        self.input_layer = None
        self.activation = activation
33

Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
34
    def create_variables(self, input_layer):
35 36
        NotImplementedError("Please implement this function in derived classes")

Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
37 38
    def get_graph(self):
        NotImplementedError("Please implement this function in derived classes")