Python chainer.functions 模块,spatial_pyramid_pooling_2d() 实例源码

我们从Python开源项目中,提取了以下18个代码示例,用于说明如何使用chainer.functions.spatial_pyramid_pooling_2d()

项目:Semantic-Segmentation-using-Adversarial-Networks    作者:oyam    | 项目源码 | 文件源码
def __call__(self, x):
        h = F.relu(self.conv1_1(x))
        h = F.relu(self.conv1_2(h))
        h = F.max_pooling_2d(h, 2, stride=2)
        h = F.relu(self.conv2_1(h))
        h = F.relu(self.conv2_2(h))
        h = F.max_pooling_2d(h, 2, stride=2)
        h = F.relu(self.conv3_1(h))
        h = F.relu(self.conv3_2(h))
        h = F.max_pooling_2d(h, 2, stride=2)
        h = F.relu(self.conv4_1(h))
        h = F.relu(self.conv4_2(h))
        h = F.spatial_pyramid_pooling_2d(h, 3, F.MaxPooling2D)
        h = F.tanh(self.fc4(h))
        h = F.dropout(h, ratio=.5, train=self.train)
        h = F.tanh(self.fc5(h))
        h = F.dropout(h, ratio=.5, train=self.train)
        h = self.fc6(h)
        return h
项目:chainer-speech-recognition    作者:musyoku    | 项目源码 | 文件源码
def __call__(self, x):
        return functions.spatial_pyramid_pooling_2d(x, self.pyramid_height, self.pooling_class)
项目:chainer-deconv    作者:germanRos    | 项目源码 | 文件源码
def check_forward(self, x_data, use_cudnn=True):
        x = chainer.Variable(x_data)
        y = functions.spatial_pyramid_pooling_2d(
            x, self.pyramid_height, self.pooling_class,
            use_cudnn=use_cudnn)
        self.assertEqual(y.data.dtype, self.dtype)
        y_data = cuda.to_cpu(y.data)

        self.assertEqual(self.gy.shape, y_data.shape)
项目:chainer-deconv    作者:germanRos    | 项目源码 | 文件源码
def check_forward_ones(self, x_data, use_cudnn=True):
        x = chainer.Variable(x_data)
        y = functions.spatial_pyramid_pooling_2d(
            x, self.pyramid_height, self.pooling_class, use_cudnn=use_cudnn)
        y_data = cuda.to_cpu(y.data)

        self.assertEqual(y_data.shape, (self.n, self.output_dim, 1, 1))
        self.assertEqual(y_data.dtype, self.dtype)
        gradient_check.assert_allclose(y_data, numpy.ones_like(y_data))
项目:chainer-deconv    作者:germanRos    | 项目源码 | 文件源码
def check_invalid_dtype(self):
        functions.spatial_pyramid_pooling_2d(
            self.v, 3, functions.MaxPooling2D)
项目:chainer-deconv    作者:germanRos    | 项目源码 | 文件源码
def forward(self):
        x = chainer.Variable(self.x)
        return functions.spatial_pyramid_pooling_2d(
            x, 3, functions.MaxPooling2D,
            use_cudnn=self.use_cudnn)
项目:ddnn    作者:kunglab    | 项目源码 | 文件源码
def __init__(self, pyramid_height, pooling_class, use_cudnn=True):
        self._function = "spatial_pyramid_pooling_2d"
        self.pyramid_height = pyramid_height
        self.pooling_class = pooling_class
        self.use_cudnn = use_cudnn
项目:ddnn    作者:kunglab    | 项目源码 | 文件源码
def __call__(self, x):
        return F.spatial_pyramid_pooling_2d(x, self.pyramid_height, self.pooling_class, self.use_cudnn)
项目:adversarial-autoencoder    作者:musyoku    | 项目源码 | 文件源码
def __call__(self, x):
        return functions.spatial_pyramid_pooling_2d(x, self.pyramid_height, self.pooling_class)
项目:chainer-examples    作者:nocotan    | 项目源码 | 文件源码
def __call__(self, x):
        h = F.elu(self.conv1(x))
        h = F.max_pooling_2d(h, 3, stride=2)
        h = self.res2(h, self.train)
        h = self.res3(h, self.train)
        h = self.res4(h, self.train)
        h = self.res5(h, self.train)
        h = F.spatial_pyramid_pooling_2d(h, 3, F.MaxPooling2D)

        h = F.elu(self.conv2(h))
        h = F.dropout(h, ratio=0.5)
        h = self.conv3(h)
        h = F.reshape(h, (-1, self.num_class))

        return h
项目:unrolled-gan    作者:musyoku    | 项目源码 | 文件源码
def __init__(self, pyramid_height, pooling_class, use_cudnn=True):
        self._function = "spatial_pyramid_pooling_2d"
        self.pyramid_height = pyramid_height
        self.pooling_class = pooling_class
        self.use_cudnn = use_cudnn
项目:unrolled-gan    作者:musyoku    | 项目源码 | 文件源码
def __call__(self, x):
        return F.spatial_pyramid_pooling_2d(x, self.pyramid_height, self.pooling_class, self.use_cudnn)
项目:LSGAN    作者:musyoku    | 项目源码 | 文件源码
def __init__(self, pyramid_height, pooling_class, use_cudnn=True):
        self._function = "spatial_pyramid_pooling_2d"
        self.pyramid_height = pyramid_height
        self.pooling_class = pooling_class
        self.use_cudnn = use_cudnn
项目:LSGAN    作者:musyoku    | 项目源码 | 文件源码
def __call__(self, x):
        return F.spatial_pyramid_pooling_2d(x, self.pyramid_height, self.pooling_class, self.use_cudnn)
项目:adgm    作者:musyoku    | 项目源码 | 文件源码
def __init__(self, pyramid_height, pooling_class, use_cudnn=True):
        self._function = "spatial_pyramid_pooling_2d"
        self.pyramid_height = pyramid_height
        self.pooling_class = pooling_class
        self.use_cudnn = use_cudnn
项目:adgm    作者:musyoku    | 项目源码 | 文件源码
def __call__(self, x):
        return F.spatial_pyramid_pooling_2d(x, self.pyramid_height, self.pooling_class, self.use_cudnn)
项目:fontkaruta_classifier    作者:suga93    | 项目源码 | 文件源码
def _spatial_pyramid_pooling_2d(x):
    return F.spatial_pyramid_pooling_2d(x, 4, F.MaxPooling2D)
项目:fontkaruta_classifier    作者:suga93    | 项目源码 | 文件源码
def _spatial_pyramid_pooling_2d(x):
    return F.spatial_pyramid_pooling_2d(x, 4, F.MaxPooling2D)