提交 4d4c9280 authored 作者: Arjun Jain's avatar Arjun Jain

Addressing @abergeron valid comments for fixes

上级 7a95b2a4
...@@ -7,7 +7,6 @@ import unittest ...@@ -7,7 +7,6 @@ import unittest
import numpy import numpy
import scipy
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
imported_scipy_convolve2d = False imported_scipy_convolve2d = False
...@@ -116,7 +115,7 @@ def py_conv_scipy(img, kern, mode, subsample): ...@@ -116,7 +115,7 @@ def py_conv_scipy(img, kern, mode, subsample):
for k in xrange(out.shape[1]): for k in xrange(out.shape[1]):
for s in xrange(img.shape[1]): for s in xrange(img.shape[1]):
#convolve2d or correlate #convolve2d or correlate
out[b, k, :, :] += scipy.signal.convolve2d(img[b, s, :, :], out[b, k, :, :] += convolve2d(img[b, s, :, :],
kern[k, s, :, :], kern[k, s, :, :],
mode) mode)
return out[:, :, ::subsample[0], ::subsample[1]] return out[:, :, ::subsample[0], ::subsample[1]]
...@@ -859,13 +858,8 @@ def test_gemm(): ...@@ -859,13 +858,8 @@ def test_gemm():
i = cuda_tensor4() i = cuda_tensor4()
k = cuda_tensor4() k = cuda_tensor4()
t2 = None
t0 = time.time()
cpuval = py_conv(npy_img, npy_kern, mode, subsample) cpuval = py_conv(npy_img, npy_kern, mode, subsample)
t1 = time.time()
op = theano.sandbox.cuda.blas.GpuCorrMM(border_mode=mode, \ op = theano.sandbox.cuda.blas.GpuCorrMM(border_mode=mode, \
subsample=subsample)(i, k) subsample=subsample)(i, k)
f = theano.function([i, k], op, mode=theano_mode) f = theano.function([i, k], op, mode=theano_mode)
...@@ -874,8 +868,6 @@ def test_gemm(): ...@@ -874,8 +868,6 @@ def test_gemm():
gpuval = f(npy_img, npy_kern) gpuval = f(npy_img, npy_kern)
t2 = time.time()
gpuval = numpy.asarray(gpuval) gpuval = numpy.asarray(gpuval)
rval = numpy.allclose(cpuval, gpuval, rtol=1e-4) rval = numpy.allclose(cpuval, gpuval, rtol=1e-4)
assert (rval == True) assert (rval == True)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论