本文整理汇总了Python中theano.sandbox.gpuarray.type.GpuArrayType.values_eq方法的典型用法代码示例。如果您正苦于以下问题:Python GpuArrayType.values_eq方法的具体用法?Python GpuArrayType.values_eq怎么用?Python GpuArrayType.values_eq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类theano.sandbox.gpuarray.type.GpuArrayType
的用法示例。
在下文中一共展示了GpuArrayType.values_eq方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_deep_copy
# 需要导入模块: from theano.sandbox.gpuarray.type import GpuArrayType [as 别名]
# 或者: from theano.sandbox.gpuarray.type.GpuArrayType import values_eq [as 别名]
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)
示例2: test_transfer_cpu_gpu
# 需要导入模块: from theano.sandbox.gpuarray.type import GpuArrayType [as 别名]
# 或者: from theano.sandbox.gpuarray.type.GpuArrayType import values_eq [as 别名]
def test_transfer_cpu_gpu():
a = T.fmatrix('a')
g = GpuArrayType(dtype='float32', broadcastable=(False, False))('g')
av = numpy.asarray(rng.rand(5, 4), dtype='float32')
gv = gpuarray.array(av)
f = theano.function([a], gpu_from_host(a))
fv = f(av)
assert GpuArrayType.values_eq(fv, gv)
f = theano.function([g], host_from_gpu(g))
fv = f(gv)
assert numpy.all(fv == av)
示例3: test_transfer_strided
# 需要导入模块: from theano.sandbox.gpuarray.type import GpuArrayType [as 别名]
# 或者: from theano.sandbox.gpuarray.type.GpuArrayType import values_eq [as 别名]
def test_transfer_strided():
# This is just to ensure that it works in theano
# compyte has a much more comprehensive suit of tests to ensure correctness
a = T.fmatrix('a')
g = GpuArrayType(dtype='float32', broadcastable=(False, False))('g')
av = numpy.asarray(rng.rand(5, 8), dtype='float32')
gv = gpuarray.array(av)
av = av[:,::2]
gv = gv[:,::2]
f = theano.function([a], gpu_from_host(a))
fv = f(av)
assert GpuArrayType.values_eq(fv, gv)
f = theano.function([g], host_from_gpu(g))
fv = f(gv)
assert numpy.all(fv == av)