提交 4a6530dc authored 作者: Benjamin Scellier's avatar Benjamin Scellier

file theano/gpuarray/tests/test_gemmcorr3d.py

上级 69d5b5d6
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
import unittest import unittest
import numpy import numpy as np
import theano import theano
from theano import config from theano import config
...@@ -23,8 +23,8 @@ class TestCorr3dMM(unittest.TestCase): ...@@ -23,8 +23,8 @@ class TestCorr3dMM(unittest.TestCase):
inputs_shape = [inputs_shape[i] for i in (0, 4, 1, 2, 3)] inputs_shape = [inputs_shape[i] for i in (0, 4, 1, 2, 3)]
filters_shape = [filters_shape[i] for i in (0, 4, 1, 2, 3)] filters_shape = [filters_shape[i] for i in (0, 4, 1, 2, 3)]
inputs_val = numpy.random.random(inputs_shape).astype(config.floatX) inputs_val = np.random.random(inputs_shape).astype(config.floatX)
filters_val = numpy.random.random(filters_shape).astype(config.floatX) filters_val = np.random.random(filters_shape).astype(config.floatX)
inputs = gpuarray_shared_constructor(inputs_val) inputs = gpuarray_shared_constructor(inputs_val)
filters = gpuarray_shared_constructor(filters_val) filters = gpuarray_shared_constructor(filters_val)
...@@ -121,11 +121,11 @@ class TestCorr3dMM(unittest.TestCase): ...@@ -121,11 +121,11 @@ class TestCorr3dMM(unittest.TestCase):
filters_shape = [filters_shape[i] for i in (0, 4, 1, 2, 3)] filters_shape = [filters_shape[i] for i in (0, 4, 1, 2, 3)]
dCdH_shape = [dCdH_shape[i] for i in (0, 4, 1, 2, 3)] dCdH_shape = [dCdH_shape[i] for i in (0, 4, 1, 2, 3)]
inputs_val = numpy.random.random(inputs_shape).astype(config.floatX) inputs_val = np.random.random(inputs_shape).astype(config.floatX)
dCdH_val = numpy.random.random(dCdH_shape).astype(config.floatX) dCdH_val = np.random.random(dCdH_shape).astype(config.floatX)
inputs = gpuarray_shared_constructor(inputs_val) inputs = gpuarray_shared_constructor(inputs_val)
dCdH = gpuarray_shared_constructor(dCdH_val) dCdH = gpuarray_shared_constructor(dCdH_val)
shape = gpuarray_shared_constructor(numpy.array(filters_shape[2:])) shape = gpuarray_shared_constructor(np.array(filters_shape[2:]))
if (subsample == (1, 1, 1)): if (subsample == (1, 1, 1)):
conv_ref = Corr3dMM_gradWeights(subsample=subsample)( conv_ref = Corr3dMM_gradWeights(subsample=subsample)(
...@@ -168,15 +168,15 @@ class TestCorr3dMM(unittest.TestCase): ...@@ -168,15 +168,15 @@ class TestCorr3dMM(unittest.TestCase):
inputs_shape = [inputs_shape[i] for i in (0, 4, 1, 2, 3)] inputs_shape = [inputs_shape[i] for i in (0, 4, 1, 2, 3)]
filters_shape = [filters_shape[i] for i in (0, 4, 1, 2, 3)] filters_shape = [filters_shape[i] for i in (0, 4, 1, 2, 3)]
inputs_val = numpy.random.random(inputs_shape).astype(config.floatX) inputs_val = np.random.random(inputs_shape).astype(config.floatX)
filters_val = numpy.random.random(filters_shape).astype(config.floatX) filters_val = np.random.random(filters_shape).astype(config.floatX)
inputs = gpuarray_shared_constructor(inputs_val) inputs = gpuarray_shared_constructor(inputs_val)
filters = gpuarray_shared_constructor(filters_val) filters = gpuarray_shared_constructor(filters_val)
bottom_height = (inputs_shape[2] - 1) * subsample[0] + filters_shape[2] bottom_height = (inputs_shape[2] - 1) * subsample[0] + filters_shape[2]
bottom_width = (inputs_shape[3] - 1) * subsample[1] + filters_shape[3] bottom_width = (inputs_shape[3] - 1) * subsample[1] + filters_shape[3]
bottom_depth = (inputs_shape[4] - 1) * subsample[2] + filters_shape[4] bottom_depth = (inputs_shape[4] - 1) * subsample[2] + filters_shape[4]
bottom_shape = gpuarray_shared_constructor(numpy.array([bottom_height, bottom_width, bottom_depth])) bottom_shape = gpuarray_shared_constructor(np.array([bottom_height, bottom_width, bottom_depth]))
if (subsample == (1, 1, 1)): if (subsample == (1, 1, 1)):
conv_ref = Corr3dMM_gradInputs(subsample=subsample)( conv_ref = Corr3dMM_gradInputs(subsample=subsample)(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论