コード例 #1
0
ファイル: test_type.py プロジェクト: 317070/Theano
def test_values_eq_approx():
    a = rand_gpuarray(20, dtype='float32')
    g = GpuArrayType(dtype='float32', broadcastable=(False,))('g')
    assert GpuArrayType.values_eq_approx(a, a)
    b = a.copy()
    b[0] = numpy.asarray(b[0]) + 1.
    assert not GpuArrayType.values_eq_approx(a, b)
    b = a.copy()
    b[0] = -numpy.asarray(b[0])
    assert not GpuArrayType.values_eq_approx(a, b)
コード例 #2
0
def test_values_eq_approx():
    a = rand_gpuarray(20, dtype='float32')
    g = GpuArrayType(dtype='float32', broadcastable=(False, ))('g')
    assert GpuArrayType.values_eq_approx(a, a)
    b = a.copy()
    b[0] = numpy.asarray(b[0]) + 1.
    assert not GpuArrayType.values_eq_approx(a, b)
    b = a.copy()
    b[0] = -numpy.asarray(b[0])
    assert not GpuArrayType.values_eq_approx(a, b)
コード例 #3
0
ファイル: test_type.py プロジェクト: 317070/Theano
def test_deep_copy():
    a = rand_gpuarray(20, dtype='float32')
    g = GpuArrayType(dtype='float32', broadcastable=(False,))('g')

    f = theano.function([g], g)

    assert isinstance(f.maker.fgraph.toposort()[0].op, DeepCopyOp)

    res = f(a)

    assert GpuArrayType.values_eq(res, a)
コード例 #4
0
def test_deep_copy():
    a = rand_gpuarray(20, dtype='float32')
    g = GpuArrayType(dtype='float32', broadcastable=(False, ))('g')

    f = theano.function([g], g)

    assert isinstance(f.maker.fgraph.toposort()[0].op, DeepCopyOp)

    res = f(a)

    assert GpuArrayType.values_eq(res, a)
コード例 #5
0
ファイル: test_elemwise.py プロジェクト: yaoli/Theano
 def rand_cval(self, shp):
     return rand_gpuarray(*shp, **dict(cls=gpuarray))
コード例 #6
0
ファイル: test_elemwise.py プロジェクト: todototry/Theano
 def rand_val(self, shp):
     return rand_gpuarray(*shp, **dict(cls=gpuarray))
コード例 #7
0
ファイル: test_type.py プロジェクト: 317070/Theano
def test_specify_shape():
    a = rand_gpuarray(20, dtype='float32')
    g = GpuArrayType(dtype='float32', broadcastable=(False,))('g')
    f = theano.function([g], theano.tensor.specify_shape(g, [20]))
    f(a)
コード例 #8
0
def test_specify_shape():
    a = rand_gpuarray(20, dtype='float32')
    g = GpuArrayType(dtype='float32', broadcastable=(False, ))('g')
    f = theano.function([g], theano.tensor.specify_shape(g, [20]))
    f(a)