提交 ab660ca3 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

Merge pull request #1631 from nouiz/scan

Compile the inner fct in scan only once per instance.
...@@ -566,12 +566,15 @@ class Scan(PureOp): ...@@ -566,12 +566,15 @@ class Scan(PureOp):
profile = ScanProfileStats(name=self.name) profile = ScanProfileStats(name=self.name)
elif self.profile: elif self.profile:
profile = self.profile profile = self.profile
self.fn = function(wrapped_inputs, # make_thunk can be called many times on the same op
wrapped_outputs, # we do not want to recompile the inner fct every time.
mode=self.mode_instance, if not getattr(self, 'fn', None):
name=self.name, self.fn = function(wrapped_inputs,
profile=profile, wrapped_outputs,
on_unused_input='ignore') mode=self.mode_instance,
name=self.name,
profile=profile,
on_unused_input='ignore')
try: try:
cython_mintaps = numpy.asarray(self.mintaps, dtype='int32') cython_mintaps = numpy.asarray(self.mintaps, dtype='int32')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论