Skip to content

Commit

Permalink
raise an error
Browse files Browse the repository at this point in the history
  • Loading branch information
mitmul committed Sep 11, 2017
1 parent 0310d2f commit 1a053f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
10 changes: 8 additions & 2 deletions chainer/functions/array/spatial_transformer_grid.py
Expand Up @@ -3,9 +3,9 @@
import chainer
from chainer import cuda
from chainer import function
from chainer.utils import argument
from chainer.utils import type_check


if cuda.cudnn_enabled:
cudnn = cuda.cudnn
libcudnn = cudnn.cudnn
Expand Down Expand Up @@ -112,7 +112,7 @@ def _backward(self, inputs, grad_outputs):
return gtheta,


def spatial_transformer_grid(theta, output_shape):
def spatial_transformer_grid(theta, output_shape, **kwargs):
"""2D Spatial Transformer grid.
This function generates coordinates of the points sampled from an image
Expand Down Expand Up @@ -160,4 +160,10 @@ def spatial_transformer_grid(theta, output_shape):
the upper-left corner of the input image.
"""
argument.check_unexpected_kwargs(
kwargs, use_cudnn="The argument \"use_cudnn\" is not "
"supported anymore. "
"Use chainer.using_config('use_cudnn', value) "
"context where value can be `always`, `never`, or `auto`.")
argument.assert_kwargs_empty(kwargs)
return SpatialTransformerGrid(output_shape)(theta)
9 changes: 8 additions & 1 deletion chainer/functions/array/spatial_transformer_sampler.py
Expand Up @@ -3,6 +3,7 @@
import chainer
from chainer import cuda
from chainer import function
from chainer.utils import argument
from chainer.utils import type_check


Expand Down Expand Up @@ -248,7 +249,7 @@ def _backward(self, inputs, grad_outputs):
return gx, ggrid


def spatial_transformer_sampler(x, grid):
def spatial_transformer_sampler(x, grid, **kwargs):
"""2D Spatial Transformer sampler.
This is a differentiable image sampler. With a set of sampling points
Expand Down Expand Up @@ -299,4 +300,10 @@ def spatial_transformer_sampler(x, grid):
:math:`(n, c_I, h_O, w_O)`.
"""
argument.check_unexpected_kwargs(
kwargs, use_cudnn="The argument \"use_cudnn\" is not "
"supported anymore. "
"Use chainer.using_config('use_cudnn', value) "
"context where value can be `always`, `never`, or `auto`.")
argument.assert_kwargs_empty(kwargs)
return SpatialTransformerSampler()(x, grid)

0 comments on commit 1a053f1

Please sign in to comment.