提交 f1d4a78b authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Add make_variable and move value_zeros.

上级 cd064270
...@@ -15,10 +15,6 @@ except ImportError: ...@@ -15,10 +15,6 @@ except ImportError:
pass pass
class GpuArrayType(Type): class GpuArrayType(Type):
def value_zeros(self, shape):
return pygpu.gpuarray.zeros(shape, dtype=self.typecode, kind=self.kind,
context=self.context)
def __init__(self, dtype, broadcastable, kind=None, context=None, def __init__(self, dtype, broadcastable, kind=None, context=None,
name=None): name=None):
import globals import globals
...@@ -99,6 +95,13 @@ class GpuArrayType(Type): ...@@ -99,6 +95,13 @@ class GpuArrayType(Type):
"(1e-8 + 1e-5 * fabs(%(b)s)))") "(1e-8 + 1e-5 * fabs(%(b)s)))")
return numpy.asarray(res).all() return numpy.asarray(res).all()
def value_zeros(self, shape):
return pygpu.gpuarray.zeros(shape, dtype=self.typecode, kind=self.kind,
context=self.context)
def make_variable(self, name=None):
return self.Variable(self, name=name)
def __eq__(self, other): def __eq__(self, other):
return (type(self) == type(other) and return (type(self) == type(other) and
self.typecode == other.typecode and self.typecode == other.typecode and
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论