Commit fdfa63eb authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Created average pooling

parent 3ed2c592
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# @author: Tiago de Freitas Pereira <>
# @date: Wed 11 May 2016 17:38 CEST
import tensorflow as tf
from bob.learn.tensorflow.util import *
from .MaxPooling import MaxPooling
class AveragePooling(MaxPooling):
def __init__(self, name, shape=[1, 2, 2, 1],
strides=[1, 1, 1, 1],
super(AveragePooling, self).__init__(name, activation=activation, batch_norm=batch_norm)
self.shape = shape
self.strides = strides
def get_graph(self, training_phase=True):
with tf.name_scope(str(
output = tf.nn.avg_pool(self.input_layer, ksize=self.shape, strides=self.strides, padding='SAME')
if self.batch_norm:
output = self.batch_normalize(output, training_phase)
if self.activation is not None:
output = self.activation(output)
return output
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment