Closed dalstonChen closed 7 years ago
Hi,
I didn't see any code related to AveragePooling
.
Perhaps you mistook UpSampling
with AveragePooling
?
The UpSampling1D
is just repeating each timestep length
times along the time axis.(see Keras documentation)
So what you see in
print out['upsampling_out']
is just a doubled tensor in each timestep of print out['pooling_out']
BTW: There two backends for Keras, so you can check backend/theano_backend.py
for further code support. The AveragePooling1D
is defined in layers/convolutional.py
, and it will call pool2d()
in backend/theano_backend.py
Hi, I checked the source code of keras in my system (version==0.3.0), and found it goes wrong. I am not sure if someone rewrite the code or the code had bugs. When I update the keras to the lasted version, the result comes to be right. Thank you very much!
class UpSampling1D(Layer):
input_ndim = 3
def __init__(self, length=2, **kwargs):
super(UpSampling1D, self).__init__(**kwargs)
self.length = length
self.input = K.placeholder(ndim=3)
@property
def output_shape(self):
input_shape = self.input_shape
return (input_shape[0], self.length * input_shape[1], input_shape[2])
def get_output(self, train=False):
X = self.get_input(train)
output = K.concatenate([X] * self.length, axis=1)
return output
def get_config(self):
config = {"name": self.__class__.__name__,
"length": self.length}
base_config = super(UpSampling1D, self).get_config()
return dict(list(base_config.items()) + list(config.items()))
Above is the code of Upsampling function from the version 0.3.0, which might be wrong.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.
Hi,
I am confused by the MaxPooling1D() function, why the output of it is the same as ave-pooling? I pass the parameter just as the document says.
I have tried to read the source code of keras, but it's an implementation using TensorFlow which I am not quiet familiar with.
plus, this code will get error if I use keras 0.3.1, while 0.3.0 seems to be OK.
Could anyone who is familiar with max-pooling can help me ?
Here's my code: (sorry for the messy)
and it's the result(according to the code above):
it shows that the
pooling_out
tensor is the same as the output of average-pooling.Thanks!