提交 69d5b5d6 authored 作者: Benjamin Scellier's avatar Benjamin Scellier

file theano/gpuarray/tests/test_gemmcorr.py

上级 aec6d167
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 TestCorrMM(unittest.TestCase): ...@@ -23,8 +23,8 @@ class TestCorrMM(unittest.TestCase):
inputs_shape = [inputs_shape[i] for i in (0, 3, 1, 2)] inputs_shape = [inputs_shape[i] for i in (0, 3, 1, 2)]
filters_shape = [filters_shape[i] for i in (0, 3, 1, 2)] filters_shape = [filters_shape[i] for i in (0, 3, 1, 2)]
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)
...@@ -122,11 +122,11 @@ class TestCorrMM(unittest.TestCase): ...@@ -122,11 +122,11 @@ class TestCorrMM(unittest.TestCase):
filters_shape = [filters_shape[i] for i in (0, 3, 1, 2)] filters_shape = [filters_shape[i] for i in (0, 3, 1, 2)]
dCdH_shape = [dCdH_shape[i] for i in (0, 3, 1, 2)] dCdH_shape = [dCdH_shape[i] for i in (0, 3, 1, 2)]
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)): if (subsample == (1, 1)):
conv_ref = CorrMM_gradWeights(subsample=subsample)( conv_ref = CorrMM_gradWeights(subsample=subsample)(
...@@ -169,14 +169,14 @@ class TestCorrMM(unittest.TestCase): ...@@ -169,14 +169,14 @@ class TestCorrMM(unittest.TestCase):
inputs_shape = [inputs_shape[i] for i in (0, 3, 1, 2)] inputs_shape = [inputs_shape[i] for i in (0, 3, 1, 2)]
filters_shape = [filters_shape[i] for i in (0, 3, 1, 2)] filters_shape = [filters_shape[i] for i in (0, 3, 1, 2)]
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_shape = gpuarray_shared_constructor(numpy.array([bottom_height, bottom_width])) bottom_shape = gpuarray_shared_constructor(np.array([bottom_height, bottom_width]))
if (subsample == (1, 1)): if (subsample == (1, 1)):
conv_ref = CorrMM_gradInputs(subsample=subsample)( conv_ref = CorrMM_gradInputs(subsample=subsample)(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论