提交 feeb8b3d authored 作者: lamblin's avatar lamblin

Merge pull request #1214 from nouiz/infer_shape_broadcast_fix

Infer shape broadcast fix
......@@ -420,6 +420,11 @@ else:
" want theano to use.")
default_openmp = count > 1
# Disable it by default for now as currently only the ConvOp support
# it And this cause slow down by default as we do not disable it for
# too small convolution.
default_openmp = False
AddConfigVar('openmp',
"Allow (or not) parallel computation on the CPU with OpenMP. "
"This is the default value used when creating an Op that "
......
......@@ -1609,7 +1609,6 @@ class GCC_compiler(object):
try:
p = call_subprocess_Popen(cmd, stderr=subprocess.PIPE)
p.wait()
compile_stderr = p.communicate()[1]
except Exception:
# An exception can occur e.g. if `g++` is not found.
......
......@@ -820,7 +820,10 @@ class ShapeFeature(object):
shape_vars.append(self.lscalar_one)
else:
shape_vars.append(self.unpack(s[i]))
assert all([not r.type.broadcastable[i] or
assert all([not hasattr(r.type, "broadcastable") or
not r.type.broadcastable[i] or
# The two following comparison are a speed optimization
# But we never timed this speed optimization!
self.lscalar_one.equals(shape_vars[i]) or
self.lscalar_one.equals(
T.extract_constant(shape_vars[i]))
......@@ -866,8 +869,11 @@ class ShapeFeature(object):
merged_shape.append(r_shape[i])
else:
merged_shape.append(other_shape[i])
assert all([(not r.type.broadcastable[i] and
assert all([(not hasattr(r.type, "broadcastable") or
not r.type.broadcastable[i] and
not other_r.type.broadcastable[i]) or
# The two following comparison are a speed optimization
# But we never timed this speed optimization!
self.lscalar_one.equals(merged_shape[i]) or
self.lscalar_one.equals(
T.extract_constant(merged_shape[i]))
......@@ -888,7 +894,10 @@ class ShapeFeature(object):
new_shape.append(self.unpack(s_i))
else:
new_shape.append(s_j)
assert all([not r.type.broadcastable[i] or
assert all([not hasattr(r.type, "broadcastable") or
not r.type.broadcastable[i] or
# The two following comparison are a speed optimization
# But we never timed this speed optimization!
self.lscalar_one.equals(new_shape[i]) or
self.lscalar_one.equals(T.extract_constant(new_shape[i]))
for i in range(r.ndim)])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论