Search code examples
pythonconv-neural-networkchainermax-pooling

Error while handling chainer.function.max_pooling_2d in python


I am using max_pooling function using chainer for maxpooling operation in CNN.

I am getting the following error. i have placed the code which i used for max_pooling operation.what i need to do to resolve this issue?

Pool_1=F.max_pooling_2d(Feature_map1_pool, ksize=3, stride=None, pad=0, cover_all=True, return_indices=False)
InvalidType:  Invalid operation is performed in: MaxPooling2D
(Forward)

Expect: in_types[0].dtype.kind == f

Actual: O != f

Solution

  • InvalidType: Invalid operation is performed in: MaxPooling2D (Forward)
    
    Expect: in_types[0].dtype.kind == f
    
    Actual: O != f
    

    This error indicates that the argument Feature_map1_pool has the dtype 'O' = 'object'.

    There should be some mistake in creation of the array Feature_map1_pool. There are many ways from which such array may result. The following code is just one example.

    Feature_map1_pool = numpy.asarray([numpy.array([2, 2]), numpy.array([1])])