提交 a42829a4 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Merge pull request #453 from nouiz/mixed2

Mixed changes
...@@ -71,7 +71,7 @@ class Validator: ...@@ -71,7 +71,7 @@ class Validator:
try: try:
env.validate() env.validate()
return True return True
except: except Exception:
return False return False
env.consistent = consistent env.consistent = consistent
...@@ -118,7 +118,7 @@ class ReplaceValidate(History, Validator): ...@@ -118,7 +118,7 @@ class ReplaceValidate(History, Validator):
raise raise
try: try:
env.validate() env.validate()
except: except Exception, e:
env.revert(chk) env.revert(chk)
raise raise
...@@ -155,7 +155,7 @@ class NodeFinder(dict, Bookkeeper): ...@@ -155,7 +155,7 @@ class NodeFinder(dict, Bookkeeper):
print >> sys.stderr, 'OFFENDING node', type(node), type(node.op) print >> sys.stderr, 'OFFENDING node', type(node), type(node.op)
try: try:
print >> sys.stderr, 'OFFENDING node hash', hash(node.op) print >> sys.stderr, 'OFFENDING node hash', hash(node.op)
except: except Exception:
print >> sys.stderr, 'OFFENDING node not hashable' print >> sys.stderr, 'OFFENDING node not hashable'
raise e raise e
......
...@@ -1139,6 +1139,20 @@ test_shared_options2 = theano.tensor.tests.test_sharedvar.makeSharedTester( ...@@ -1139,6 +1139,20 @@ test_shared_options2 = theano.tensor.tests.test_sharedvar.makeSharedTester(
op_by_matrix_=True, op_by_matrix_=True,
name='test_shared_options') name='test_shared_options')
def speed_adv_sub1():
data = numpy.random.rand(50000, 21).astype("float32")
var = tcn.shared_constructor(data)
vec = tensor.lvector()
for batch_size in [100, 1000, 10000, 100000]:
idx = numpy.random.randint(0, 50000, batch_size)
mode_with_gpu = theano.compile.ProfileMode().including('gpu')
f = theano.function([vec], var[vec], mode=mode_with_gpu)
for i in range(100):
f(idx)
print "ProfileMode with batch size", batch_size
mode_with_gpu.print_summary()
if __name__ == '__main__': if __name__ == '__main__':
test_many_arg_elemwise() test_many_arg_elemwise()
test_gpujoin_twomatrices_joincolumns() test_gpujoin_twomatrices_joincolumns()
......
...@@ -5186,6 +5186,18 @@ class AdvancedIncSubtensor1(Op): ...@@ -5186,6 +5186,18 @@ class AdvancedIncSubtensor1(Op):
and self.inplace == other.inplace and self.inplace == other.inplace
and self.set_instead_of_inc == other.set_instead_of_inc) and self.set_instead_of_inc == other.set_instead_of_inc)
def __str__(self):
if self.inplace:
msg = "inplace"
else:
msg = "no_inplace"
if self.set_instead_of_inc:
msg += ",set"
else:
msg += ",inc"
return self.__class__.__name__ + "{%s}" % msg
def make_node(self, x, y, ilist): def make_node(self, x, y, ilist):
x_ = as_tensor_variable(x) x_ = as_tensor_variable(x)
y_ = as_tensor_variable(y) y_ = as_tensor_variable(y)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论