提交 0975c51f authored 作者: Ian Goodfellow's avatar Ian Goodfellow

got rid of cuda-specific scalar C code methods

上级 283546f5
...@@ -816,24 +816,6 @@ class ScalarOp(Op): ...@@ -816,24 +816,6 @@ class ScalarOp(Op):
else: else:
return self.__class__.__name__ return self.__class__.__name__
def cuda_assign_reduce(self, left, right):
""" Returns CUDA code assigning the reduction of left and right
using this scalar operation to left."""
raise NotImplementedError(
str(self)+" does not implement cuda_assign_reduce")
def cuda_assign_reduce_code_cache_version(self):
""" Returns a tuple of integers representing the version of the
scalar op's cuda_assign_reduce method. Must be unique across ops.
An empty tuple means not to use code caching for this op"""
# Because this is the abstract parent class, we must return ()
# Returning a non-empty tuple would enable caching for all scalar
# ops, and some ops may be incompatible with it
return ()
def c_code_cache_version(self): def c_code_cache_version(self):
return (4,) return (4,)
...@@ -1178,12 +1160,6 @@ class Maximum(BinaryScalarOp): ...@@ -1178,12 +1160,6 @@ class Maximum(BinaryScalarOp):
gy = eq(output, y) * gz gy = eq(output, y) * gz
return (gx, gy) return (gx, gy)
def cuda_assign_reduce(self, left, right):
return left + ' = max(' + left + ', '+ right + ');'
def cuda_assign_reduce_code_cache_version(self):
# Maximum's unique identifier is 0
# Version 0 of its code
return (0,0)
maximum = Maximum(upcast_out, name='maximum') maximum = Maximum(upcast_out, name='maximum')
...@@ -1247,13 +1223,6 @@ class Add(ScalarOp): ...@@ -1247,13 +1223,6 @@ class Add(ScalarOp):
retval += [gz] retval += [gz]
return retval return retval
def cuda_assign_reduce(self, left, right):
return left + ' += ' + right + ';'
def cuda_assign_reduce_code_cache_version(self):
# Add's unique identifier is 1
# Version 0 of its code
return (1,0)
add = Add(upcast_out, name='add') add = Add(upcast_out, name='add')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论