提交 7d50d94e authored 作者: Roy Xue's avatar Roy Xue 提交者: Lijun Xue

Update algo

上级 ea46e3c6
import StringIO
import numpy
import theano
import theano.tensor as T
from theano.ifelse import ifelse
def test_reduce():
config1 = theano.config.profile
config2 = theano.config.profile_memory
config3 = theano.config.profiling.min_peak_memory
try:
theano.config.profile = True
theano.config.profile_memory = True
theano.config.profiling.min_peak_memory = True
x = T.scalar('x')
y = T.scalar('y')
z = ifelse(T.lt(3. * x, y), 3., 4.)
p = theano.ProfileStats(False)
if theano.config.mode in ["DebugMode", "DEBUG_MODE", "FAST_COMPILE"]:
m = "FAST_RUN"
else:
m = None
f = theano.function([x, y], z, profile=p, name="test_profiling",
mode=m)
out = f(1, 2)
finally:
theano.config.profile = config1
theano.config.profile_memory = config2
theano.config.profiling.min_peak_memory = config3
if __name__ == "__main__":
test_reduce()
......@@ -894,12 +894,16 @@ class VM_Linker(link.LocalLinker):
for idx in range(len(order)):
node = order[idx]
for ins in node.inputs:
if ins.ndim == 0:
if ins.ndim == 0 and storage_map[ins][0]:
# check if input variable ndim = 0
for i in range(idx + 1, len(order)):
for outs in order[i].outputs:
if outs.ndim == 0:
storage_map[outs] = storage_map[ins]
break
else:
continue
break
for node in order:
try:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论