提交 12cf4a49 authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Disable wraparound checks in scan_perform.pyx

上级 6b4c933d
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -62,7 +62,7 @@ numpy.import_array() ...@@ -62,7 +62,7 @@ numpy.import_array()
def get_version(): def get_version():
return 0.322 return 0.323
@cython.cdivision(True) @cython.cdivision(True)
...@@ -70,8 +70,7 @@ cdef inline unsigned int pymod(int a, unsigned int b): ...@@ -70,8 +70,7 @@ cdef inline unsigned int pymod(int a, unsigned int b):
return (a % (<int>b) + <int>b) % b return (a % (<int>b) + <int>b) % b
# TODO: We need to get rid of the negative indexing performed with `pos` and `l`. @cython.wraparound(False)
# @cython.wraparound(False)
@cython.cdivision(True) @cython.cdivision(True)
@cython.boundscheck(False) @cython.boundscheck(False)
def perform( def perform(
...@@ -260,7 +259,6 @@ def perform( ...@@ -260,7 +259,6 @@ def perform(
# Put in the values of the initial state # Put in the values of the initial state
outer_outputs_idx[0] = outer_outputs_idx_0[:store_steps[idx]] outer_outputs_idx[0] = outer_outputs_idx_0[:store_steps[idx]]
if idx > n_mit_mot: if idx > n_mit_mot:
# TODO FIXME: Do not use wrapped indexing!
l = - mintaps[idx] l = - mintaps[idx]
outer_outputs_idx_0[:l] = outer_inputs[<unsigned int>(seqs_arg_offset + idx)][:l] outer_outputs_idx_0[:l] = outer_inputs[<unsigned int>(seqs_arg_offset + idx)][:l]
else: else:
...@@ -271,18 +269,12 @@ def perform( ...@@ -271,18 +269,12 @@ def perform(
if n_steps == 0: if n_steps == 0:
for idx in range(n_outs, n_outs + n_nit_sot): for idx in range(n_outs, n_outs + n_nit_sot):
if outs_is_tensor[idx]: if outs_is_tensor[idx]:
# TODO FIXME: Why have an `outs_is_tensor` when you can access
# the node directly?
# (The answer is that you shouldn't have a `node` object to
# access, because it's not going to produce a very efficient
# Cython function!)
outer_outputs[idx][0] = numpy.empty((0,) * outer_output_ndims[idx], dtype=outer_output_dtypes[idx]) outer_outputs[idx][0] = numpy.empty((0,) * outer_output_ndims[idx], dtype=outer_output_dtypes[idx])
else: else:
outer_outputs[idx][0] = None outer_outputs[idx][0] = None
return 0.0, 0 return 0.0, 0
for idx in range(lenpos): for idx in range(lenpos):
# TODO FIXME: Do not use wrapped indexing!
pos[idx] = pymod(-mintaps[idx], store_steps[idx]) pos[idx] = pymod(-mintaps[idx], store_steps[idx])
offset = nit_sot_arg_offset + n_nit_sot offset = nit_sot_arg_offset + n_nit_sot
......
...@@ -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.322 # must match constant returned in function get_version() version = 0.323 # 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论