提交 77c7836e authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Simplify array copying in scan_perform.pyx

上级 12cf4a49
...@@ -62,7 +62,7 @@ numpy.import_array() ...@@ -62,7 +62,7 @@ numpy.import_array()
def get_version(): def get_version():
return 0.323 return 0.324
@cython.cdivision(True) @cython.cdivision(True)
...@@ -556,15 +556,11 @@ def perform( ...@@ -556,15 +556,11 @@ def perform(
# are read and written. # are read and written.
# This way, there will be no information overwritten # This way, there will be no information overwritten
# before it is read (as it used to happen). # before it is read (as it used to happen).
shape = (pdx,)+ outer_outputs_idx_0.shape[1:] tmp = outer_outputs_idx_0[:pdx].copy()
tmp = numpy.empty(shape, dtype=outer_output_dtypes[idx])
tmp[:] = outer_outputs_idx_0[:pdx]
outer_outputs_idx_0[:store_steps_idx - pdx] = outer_outputs_idx_0[pdx:] outer_outputs_idx_0[:store_steps_idx - pdx] = outer_outputs_idx_0[pdx:]
outer_outputs_idx_0[store_steps_idx - pdx:] = tmp outer_outputs_idx_0[store_steps_idx - pdx:] = tmp
else: else:
shape = (store_steps_idx - pdx,) + outer_outputs_idx_0.shape[1:] tmp = outer_outputs_idx_0[pdx:].copy()
tmp = numpy.empty(shape, dtype=outer_output_dtypes[idx])
tmp[:] = outer_outputs_idx_0[pdx:]
outer_outputs_idx_0[store_steps_idx - pdx:] = outer_outputs_idx_0[:pdx] outer_outputs_idx_0[store_steps_idx - pdx:] = outer_outputs_idx_0[:pdx]
outer_outputs_idx_0[:store_steps_idx - pdx] = tmp outer_outputs_idx_0[:store_steps_idx - pdx] = tmp
......
...@@ -23,7 +23,7 @@ if not config.cxx: ...@@ -23,7 +23,7 @@ if not config.cxx:
_logger = logging.getLogger("aesara.scan.scan_perform") _logger = logging.getLogger("aesara.scan.scan_perform")
version = 0.323 # must match constant returned in function get_version() version = 0.324 # must match constant returned in function get_version()
need_reload = False need_reload = False
scan_perform: Optional[ModuleType] = None scan_perform: Optional[ModuleType] = None
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论