diff --git a/chainer/functions/__init__.py b/chainer/functions/__init__.py index 5ee774d21290..91147f51aed3 100644 --- a/chainer/functions/__init__.py +++ b/chainer/functions/__init__.py @@ -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 @@ -293,14 +289,10 @@ 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 @@ -308,8 +300,6 @@ 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 diff --git a/chainer/functions/connection/convolution_nd.py b/chainer/functions/connection/convolution_nd.py index cc79369c0fd5..7d96cc3b570d 100644 --- a/chainer/functions/connection/convolution_nd.py +++ b/chainer/functions/connection/convolution_nd.py @@ -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) diff --git a/chainer/functions/connection/deconvolution_nd.py b/chainer/functions/connection/deconvolution_nd.py index 49b0e6065daa..311777230c4d 100644 --- a/chainer/functions/connection/deconvolution_nd.py +++ b/chainer/functions/connection/deconvolution_nd.py @@ -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) diff --git a/chainer/functions/pooling/average_pooling_nd.py b/chainer/functions/pooling/average_pooling_nd.py index 5fd79fe32a94..54196183529c 100644 --- a/chainer/functions/pooling/average_pooling_nd.py +++ b/chainer/functions/pooling/average_pooling_nd.py @@ -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) diff --git a/chainer/functions/pooling/max_pooling_nd.py b/chainer/functions/pooling/max_pooling_nd.py index 1ef0bfda6161..54b692497eb3 100644 --- a/chainer/functions/pooling/max_pooling_nd.py +++ b/chainer/functions/pooling/max_pooling_nd.py @@ -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) diff --git a/chainer/functions/pooling/unpooling_nd.py b/chainer/functions/pooling/unpooling_nd.py index 48473ed3dbfc..6297854db995 100644 --- a/chainer/functions/pooling/unpooling_nd.py +++ b/chainer/functions/pooling/unpooling_nd.py @@ -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) diff --git a/chainer/links/__init__.py b/chainer/links/__init__.py index 20ab56047c9c..23f05a20a513 100644 --- a/chainer/links/__init__.py +++ b/chainer/links/__init__.py @@ -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 diff --git a/chainer/links/connection/convolution_nd.py b/chainer/links/connection/convolution_nd.py index 8ab16a14e272..52b39cfcb7a4 100644 --- a/chainer/links/connection/convolution_nd.py +++ b/chainer/links/connection/convolution_nd.py @@ -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) diff --git a/chainer/links/connection/deconvolution_nd.py b/chainer/links/connection/deconvolution_nd.py index c9d156acb527..d33ec2dd35eb 100644 --- a/chainer/links/connection/deconvolution_nd.py +++ b/chainer/links/connection/deconvolution_nd.py @@ -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) diff --git a/docs/source/reference/functions.rst b/docs/source/reference/functions.rst index f08527b3efe9..beaff45a772a 100644 --- a/docs/source/reference/functions.rst +++ b/docs/source/reference/functions.rst @@ -110,13 +110,9 @@ Neural network connections :nosignatures: chainer.functions.bilinear - chainer.functions.convolution_1d chainer.functions.convolution_2d - chainer.functions.convolution_3d chainer.functions.convolution_nd - chainer.functions.deconvolution_1d chainer.functions.deconvolution_2d - chainer.functions.deconvolution_3d chainer.functions.deconvolution_nd chainer.functions.depthwise_convolution_2d chainer.functions.dilated_convolution_2d @@ -275,19 +271,13 @@ Spatial pooling :toctree: generated/ :nosignatures: - chainer.functions.average_pooling_1d chainer.functions.average_pooling_2d - chainer.functions.average_pooling_3d chainer.functions.average_pooling_nd - chainer.functions.max_pooling_1d chainer.functions.max_pooling_2d - chainer.functions.max_pooling_3d chainer.functions.max_pooling_nd chainer.functions.roi_pooling_2d chainer.functions.spatial_pyramid_pooling_2d - chainer.functions.unpooling_1d chainer.functions.unpooling_2d - chainer.functions.unpooling_3d chainer.functions.unpooling_nd chainer.functions.upsampling_2d diff --git a/docs/source/reference/links.rst b/docs/source/reference/links.rst index 8abf80203327..ae6b32138561 100644 --- a/docs/source/reference/links.rst +++ b/docs/source/reference/links.rst @@ -23,13 +23,9 @@ Learnable connections chainer.links.Bias chainer.links.Bilinear chainer.links.ChildSumTreeLSTM - chainer.links.Convolution1D chainer.links.Convolution2D - chainer.links.Convolution3D chainer.links.ConvolutionND - chainer.links.Deconvolution1D chainer.links.Deconvolution2D - chainer.links.Deconvolution3D chainer.links.DeconvolutionND chainer.links.DepthwiseConvolution2D chainer.links.DilatedConvolution2D