Skip to content

Commit

Permalink
Merge pull request #4475 from chainer/revert-4025-add-conv1d-conv3d
Browse files Browse the repository at this point in the history
Revert "Add alias for conv1d and conv3d"
  • Loading branch information
kmaehashi committed Mar 15, 2018
2 parents 4b9b915 + 0520e8d commit e5fe298
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 328 deletions.
10 changes: 0 additions & 10 deletions chainer/functions/__init__.py
Expand Up @@ -105,12 +105,8 @@

from chainer.functions.connection.bilinear import bilinear # NOQA
from chainer.functions.connection.convolution_2d import convolution_2d # NOQA
from chainer.functions.connection.convolution_nd import convolution_1d # NOQA
from chainer.functions.connection.convolution_nd import convolution_3d # NOQA
from chainer.functions.connection.convolution_nd import convolution_nd # NOQA
from chainer.functions.connection.deconvolution_2d import deconvolution_2d # NOQA
from chainer.functions.connection.deconvolution_nd import deconvolution_1d # NOQA
from chainer.functions.connection.deconvolution_nd import deconvolution_3d # NOQA
from chainer.functions.connection.deconvolution_nd import deconvolution_nd # NOQA
from chainer.functions.connection.depthwise_convolution_2d import depthwise_convolution_2d # NOQA
from chainer.functions.connection.dilated_convolution_2d import dilated_convolution_2d # NOQA
Expand Down Expand Up @@ -293,23 +289,17 @@

from chainer.functions.pooling.average_pooling_2d import average_pooling_2d # NOQA
from chainer.functions.pooling.average_pooling_2d import AveragePooling2D # NOQA
from chainer.functions.pooling.average_pooling_nd import average_pooling_1d # NOQA
from chainer.functions.pooling.average_pooling_nd import average_pooling_3d # NOQA
from chainer.functions.pooling.average_pooling_nd import average_pooling_nd # NOQA
from chainer.functions.pooling.average_pooling_nd import AveragePoolingND # NOQA
from chainer.functions.pooling.max_pooling_2d import max_pooling_2d # NOQA
from chainer.functions.pooling.max_pooling_2d import MaxPooling2D # NOQA
from chainer.functions.pooling.max_pooling_nd import max_pooling_1d # NOQA
from chainer.functions.pooling.max_pooling_nd import max_pooling_3d # NOQA
from chainer.functions.pooling.max_pooling_nd import max_pooling_nd # NOQA
from chainer.functions.pooling.max_pooling_nd import MaxPoolingND # NOQA
from chainer.functions.pooling.roi_pooling_2d import roi_pooling_2d # NOQA
from chainer.functions.pooling.roi_pooling_2d import ROIPooling2D # NOQA
from chainer.functions.pooling.spatial_pyramid_pooling_2d import spatial_pyramid_pooling_2d # NOQA
from chainer.functions.pooling.unpooling_2d import Unpooling2D # NOQA
from chainer.functions.pooling.unpooling_2d import unpooling_2d # NOQA
from chainer.functions.pooling.unpooling_nd import unpooling_1d # NOQA
from chainer.functions.pooling.unpooling_nd import unpooling_3d # NOQA
from chainer.functions.pooling.unpooling_nd import unpooling_nd # NOQA
from chainer.functions.pooling.unpooling_nd import UnpoolingND # NOQA
from chainer.functions.pooling.upsampling_2d import Upsampling2D # NOQA
Expand Down
46 changes: 0 additions & 46 deletions chainer/functions/connection/convolution_nd.py
Expand Up @@ -441,49 +441,3 @@ def convolution_nd(x, W, b=None, stride=1, pad=0, cover_all=False):
args = (x, W) if b is None else (x, W, b)
y, = fnode.apply(args)
return y


def convolution_1d(x, W, b=None, stride=1, pad=0, cover_all=False):
"""1-dimensional convolution function.
.. note::
This function calls :func:`~chainer.functions.convolution_nd`
internally, so see the detail in the documentation of
:func:`~chainer.functions.convolution_nd`.
"""
if len(x.shape[2:]) != 1:
raise ValueError(
'The number of dimensions under channel dimension of the input '
'\'x\' should be 1. But the actual ndim was {}.'.fromat(
len(x.shape[2:])))

func = ConvolutionND(1, stride, pad, cover_all)
if b is None:
return func(x, W)
else:
return func(x, W, b)


def convolution_3d(x, W, b=None, stride=1, pad=0, cover_all=False):
"""3-dimensional convolution function.
.. note::
This function calls :func:`~chainer.functions.convolution_nd`
internally, so see the detail in the documentation of
:func:`~chainer.functions.convolution_nd`.
"""
if len(x.shape[2:]) != 3:
raise ValueError(
'The number of dimensions under channel dimension of the input '
'\'x\' should be 3. But the actual ndim was {}.'.fromat(
len(x.shape[2:])))

func = ConvolutionND(3, stride, pad, cover_all)
if b is None:
return func(x, W)
else:
return func(x, W, b)
46 changes: 0 additions & 46 deletions chainer/functions/connection/deconvolution_nd.py
Expand Up @@ -446,49 +446,3 @@ def deconvolution_nd(x, W, b=None, stride=1, pad=0, outsize=None):
args = (x, W) if b is None else (x, W, b)
y, = func.apply(args)
return y


def deconvolution_1d(x, W, b=None, stride=1, pad=0, outsize=None):
"""1-dimensional deconvolution function.
.. note::
This function calls :func:`~chainer.functions.deconvolution_nd` with
``ndim = 1``, so see the details of the behavior in
the documentation of :func:`~chainer.functions.deconvolution_nd`.
"""
if len(x.shape[2:]) != 1:
raise ValueError(
'The number of dimensions under channel dimension of the input '
'\'x\' should be 1. But the actual ndim was {}.'.fromat(
len(x.shape[2:])))

func = DeconvolutionND(1, stride, pad, outsize)
if b is None:
return func(x, W)
else:
return func(x, W, b)


def deconvolution_3d(x, W, b=None, stride=1, pad=0, outsize=None):
"""3-dimensional deconvolution function.
.. note::
This function calls :func:`~chainer.functions.deconvolution_nd` with
``ndim = 3``, so see the details of the behavior in
the documentation of :func:`~chainer.functions.deconvolution_nd`.
"""
if len(x.shape[2:]) != 3:
raise ValueError(
'The number of dimensions under channel dimension of the input '
'\'x\' should be 3. But the actual ndim was {}.'.fromat(
len(x.shape[2:])))

func = DeconvolutionND(3, stride, pad, outsize)
if b is None:
return func(x, W)
else:
return func(x, W, b)
44 changes: 0 additions & 44 deletions chainer/functions/pooling/average_pooling_nd.py
Expand Up @@ -170,47 +170,3 @@ def average_pooling_nd(x, ksize, stride=None, pad=0):
"""
ndim = len(x.shape[2:])
return AveragePoolingND(ndim, ksize, stride=stride, pad=pad).apply((x,))[0]


def average_pooling_1d(x, ksize, stride=None, pad=0):
"""1-dimensional spatial average pooling function.
.. warning::
This feature is experimental. The interface can change in the future.
.. note::
This function calls :func:`~functions.average_pooling_nd` with
``ndim = 1``, so see the details of the behavior in
the documentation of :func:`~functions.average_pooling_nd`.
"""
if len(x.shape[2:]) != 1:
raise ValueError(
'The number of dimensions under channel dimension of the input '
'\'x\' should be 1. But the actual ndim was {}.'.fromat(
len(x.shape[2:])))
return AveragePoolingND(1, ksize, stride=stride, pad=pad)(x)


def average_pooling_3d(x, ksize, stride=None, pad=0):
"""3-dimensional spatial average pooling function.
.. warning::
This feature is experimental. The interface can change in the future.
.. note::
This function calls :func:`~functions.average_pooling_nd` with
``ndim = 3``, so see the details of the behavior in
the documentation of :func:`~functions.average_pooling_nd`.
"""
if len(x.shape[2:]) != 3:
raise ValueError(
'The number of dimensions under channel dimension of the input '
'\'x\' should be 3. But the actual ndim was {}.'.fromat(
len(x.shape[2:])))
return AveragePoolingND(3, ksize, stride=stride, pad=pad)(x)
44 changes: 0 additions & 44 deletions chainer/functions/pooling/max_pooling_nd.py
Expand Up @@ -264,47 +264,3 @@ def max_pooling_nd(x, ksize, stride=None, pad=0, cover_all=True):
"""
ndim = len(x.shape[2:])
return MaxPoolingND(ndim, ksize, stride, pad, cover_all).apply((x,))[0]


def max_pooling_1d(x, ksize, stride=None, pad=0):
"""1-dimensional spatial max pooling function.
.. warning::
This feature is experimental. The interface can change in the future.
.. note::
This function calls :func:`~functions.max_pooling_nd` with
``ndim = 1``, so see the details of the behavior in
the documentation of :func:`~functions.max_pooling_nd`.
"""
if len(x.shape[2:]) != 1:
raise ValueError(
'The number of dimensions under channel dimension of the input '
'\'x\' should be 1. But the actual ndim was {}.'.fromat(
len(x.shape[2:])))
return MaxPoolingND(1, ksize, stride=stride, pad=pad)(x)


def max_pooling_3d(x, ksize, stride=None, pad=0):
"""3-dimensional spatial max pooling function.
.. warning::
This feature is experimental. The interface can change in the future.
.. note::
This function calls :func:`~functions.max_pooling_nd` with
``ndim = 3``, so see the details of the behavior in
the documentation of :func:`~functions.max_pooling_nd`.
"""
if len(x.shape[2:]) != 3:
raise ValueError(
'The number of dimensions under channel dimension of the input '
'\'x\' should be 3. But the actual ndim was {}.'.fromat(
len(x.shape[2:])))
return MaxPoolingND(3, ksize, stride=stride, pad=pad)(x)
44 changes: 0 additions & 44 deletions chainer/functions/pooling/unpooling_nd.py
Expand Up @@ -140,47 +140,3 @@ def unpooling_nd(x, ksize, stride=None, pad=0, outsize=None, cover_all=True):
ndim = len(x.shape[2:])
return UnpoolingND(
ndim, ksize, stride, pad, outsize, cover_all).apply((x,))[0]


def unpooling_1d(x, ksize, stride=None, pad=0):
"""Inverse operation of 1-dimensional spatial pooling.
.. warning::
This feature is experimental. The interface can change in the future.
.. note::
This function calls :func:`~functions.unpooling_nd` with
``ndim = 1``, so see the details of the behavior in
the documentation of :func:`~functions.unpooling_nd`.
"""
if len(x.shape[2:]) != 1:
raise ValueError(
'The number of dimensions under channel dimension of the input '
'\'x\' should be 1. But the actual ndim was {}.'.fromat(
len(x.shape[2:])))
return UnpoolingND(1, ksize, stride=stride, pad=pad)(x)


def unpooling_3d(x, ksize, stride=None, pad=0):
"""Inverse operation of 3-dimensional spatial pooling.
.. warning::
This feature is experimental. The interface can change in the future.
.. note::
This function calls :func:`~functions.unpooling_nd` with
``ndim = 3``, so see the details of the behavior in
the documentation of :func:`~functions.unpooling_nd`.
"""
if len(x.shape[2:]) != 3:
raise ValueError(
'The number of dimensions under channel dimension of the input '
'\'x\' should be 3. But the actual ndim was {}.'.fromat(
len(x.shape[2:])))
return UnpoolingND(3, ksize, stride=stride, pad=pad)(x)
4 changes: 0 additions & 4 deletions chainer/links/__init__.py
Expand Up @@ -7,12 +7,8 @@
from chainer.links.connection.bias import Bias # NOQA
from chainer.links.connection.bilinear import Bilinear # NOQA
from chainer.links.connection.convolution_2d import Convolution2D # NOQA
from chainer.links.connection.convolution_nd import Convolution1D # NOQA
from chainer.links.connection.convolution_nd import Convolution3D # NOQA
from chainer.links.connection.convolution_nd import ConvolutionND # NOQA
from chainer.links.connection.deconvolution_2d import Deconvolution2D # NOQA
from chainer.links.connection.deconvolution_nd import Deconvolution1D # NOQA
from chainer.links.connection.deconvolution_nd import Deconvolution3D # NOQA
from chainer.links.connection.deconvolution_nd import DeconvolutionND # NOQA
from chainer.links.connection.depthwise_convolution_2d import DepthwiseConvolution2D # NOQA
from chainer.links.connection.dilated_convolution_2d import DilatedConvolution2D # NOQA
Expand Down
38 changes: 0 additions & 38 deletions chainer/links/connection/convolution_nd.py
Expand Up @@ -86,41 +86,3 @@ def __call__(self, x):
"""
return convolution_nd.convolution_nd(
x, self.W, self.b, self.stride, self.pad, cover_all=self.cover_all)


class Convolution1D(ConvolutionND):
"""1-dimensional convolution layer.
.. note::
This link wraps :class:`~chainer.links.ConvolutionND` by giving 1 to
the first argument ``ndim``, so see the details of the behavior in
the documentation of :class:`~chainer.links.ConvolutionND`.
"""

def __init__(self, in_channels, out_channels, ksize, stride=1, pad=0,
nobias=False, initialW=None, initial_bias=None,
cover_all=False):
super(Convolution1D, self).__init__(
1, in_channels, out_channels, ksize, stride, pad, nobias, initialW,
initial_bias, cover_all)


class Convolution3D(ConvolutionND):
"""3-dimensional convolution layer.
.. note::
This link wraps :class:`~chainer.links.ConvolutionND` by giving 3 to
the first argument ``ndim``, so see the details of the behavior in
the documentation of :class:`~chainer.links.ConvolutionND`.
"""

def __init__(self, in_channels, out_channels, ksize, stride=1, pad=0,
nobias=False, initialW=None, initial_bias=None,
cover_all=False):
super(Convolution3D, self).__init__(
3, in_channels, out_channels, ksize, stride, pad, nobias, initialW,
initial_bias, cover_all)
38 changes: 0 additions & 38 deletions chainer/links/connection/deconvolution_nd.py
Expand Up @@ -75,41 +75,3 @@ def __call__(self, x):
return deconvolution_nd.deconvolution_nd(
x, self.W, b=self.b, stride=self.stride, pad=self.pad,
outsize=self.outsize)


class Deconvolution1D(DeconvolutionND):
"""1-dimensional deconvolution layer.
.. note::
This link wraps :class:`~chainer.links.DeconvolutionND` by giving 1 to
the first argument ``ndim``, so see the details of the behavior in
the documentation of :class:`~chainer.links.DeconvolutionND`.
"""

def __init__(self, in_channels, out_channels, ksize, stride=1, pad=0,
nobias=False, initialW=None, initial_bias=None,
cover_all=False):
super(Deconvolution1D, self).__init__(
1, in_channels, out_channels, ksize, stride, pad, nobias, initialW,
initial_bias, cover_all)


class Deconvolution3D(DeconvolutionND):
"""3-dimensional deconvolution layer.
.. note::
This link wraps :class:`~chainer.links.DeconvolutionND` by giving 3 to
the first argument ``ndim``, so see the details of the behavior in
the documentation of :class:`~chainer.links.DeconvolutionND`.
"""

def __init__(self, in_channels, out_channels, ksize, stride=1, pad=0,
nobias=False, initialW=None, initial_bias=None,
cover_all=False):
super(Deconvolution1D, self).__init__(
3, in_channels, out_channels, ksize, stride, pad, nobias, initialW,
initial_bias, cover_all)

0 comments on commit e5fe298

Please sign in to comment.