提交 0aa5ff77 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #4018 from abergeron/fix_buildbot

Move the AbstractConv tests with the implementation
......@@ -31,6 +31,7 @@ from .bn import batch_normalization
import warnings
from .abstract_conv import conv2d as abstract_conv2d
def conv2d(input, filters, input_shape=None, filter_shape=None,
border_mode='valid', subsample=(1, 1), filter_flip=True,
image_shape=None, **kwargs):
......@@ -139,5 +140,3 @@ def conv2d(input, filters, input_shape=None, filter_shape=None,
return abstract_conv2d(input, filters, input_shape, filter_shape,
border_mode, subsample, filter_flip)
......@@ -408,7 +408,7 @@ class BaseAbstractConv2d(Op):
if len(subsample) != 2:
raise ValueError("subsample must have two elements")
self.subsample = subsample
self.subsample = tuple(subsample)
def flops(self, inp, outp):
""" Useful with the hack in profilemode to print the MFlops"""
......
......@@ -52,7 +52,7 @@ class BaseCorrMM(gof.Op):
self.border_mode = border_mode
if len(subsample) != 2:
raise ValueError("subsample must have two elements")
self.subsample = subsample
self.subsample = tuple(subsample)
@property
def pad(self):
......@@ -177,13 +177,13 @@ class BaseCorrMM(gof.Op):
if ((direction != 0) and (dH != 1)) or ((direction == 1) and (padH == -1)):
if not height:
raise ValueError("height must be given for backprop with vertical sampling or border_mode='half'")
height = '(*(npy_int*)(PyArray_DATA(%s)))' % height
height = '(*(npy_int64 *)(PyArray_DATA(%s)))' % height
else:
height = '-1'
if ((direction != 0) and (dW != 1)) or ((direction == 1) and (padW == -1)):
if not width:
raise ValueError("width must be given for backprop with horizontal sampling or border_mode='half'")
width = '(*(npy_int*)(PyArray_DATA(%s)))' % width
width = '(*(npy_int64 *)(PyArray_DATA(%s)))' % width
else:
width = '-1'
sub = sub.copy()
......@@ -314,8 +314,8 @@ class BaseCorrMM(gof.Op):
if (NULL == %(out)s)
{
PyErr_Format(PyExc_RuntimeError,
"BaseCorrMM: Failed to allocate output of %%d x %%d x %%d x %%d",
out_dim[0], out_dim[1], out_dim[2], out_dim[3]);
"BaseCorrMM: Failed to allocate output of %%lld x %%lld x %%lld x %%lld",
(long long)out_dim[0], (long long)out_dim[1], (long long)out_dim[2], (long long)out_dim[3]);
%(fail)s
}
}
......@@ -424,7 +424,7 @@ class CorrMM_gradWeights(BaseCorrMM):
if shape is None:
raise ValueError('shape must be given if subsample != (1, 1)'
' or border_mode == "half"')
height_width = [shape[0], shape[1]]
height_width = [as_tensor_variable(shape[0]).astype('int64'), as_tensor_variable(shape[1]).astype('int64')]
else:
height_width = []
......@@ -519,7 +519,7 @@ class CorrMM_gradInputs(BaseCorrMM):
raise TypeError('topgrad must be 4D tensor')
if self.subsample != (1, 1) and shape is None:
raise ValueError('shape must be given if subsample != (1, 1)')
height_width = [shape[0], shape[1]] if self.subsample != (1, 1) else []
height_width = [as_tensor_variable(shape[0]).astype('int64'), as_tensor_variable(shape[1]).astype('int64')] if self.subsample != (1, 1) else []
broadcastable = [topgrad.type.broadcastable[0], kern.type.broadcastable[1],
False, False]
......
......@@ -162,7 +162,7 @@ PyArrayObject* corrMM(PyArrayObject* bottom,
"CorrMM shape inconsistency:\n"
" bottom shape: %%d %%d %%d %%d\n"
" weight shape: %%d %%d %%d %%d\n"
" top shape: %%d %%d %%d %%d (expected %%d %%d %%d %%d)\n",
" top shape: %%ld %%ld %%ld %%ld (expected %%d %%d %%d %%d)\n",
batchSize, nChannels, bottomHeight, bottomWidth,
nFilters, nChannels, kH, kW,
PyArray_DIMS(top)[0], PyArray_DIMS(top)[1],
......@@ -182,7 +182,7 @@ PyArrayObject* corrMM(PyArrayObject* bottom,
if (NULL == col)
{
PyErr_Format(PyExc_RuntimeError,
"CorrMM failed to allocate working memory of %%d x %%d\n",
"CorrMM failed to allocate working memory of %%ld x %%ld\n",
col_dim[0], col_dim[1]);
return NULL;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论