提交 52af6d7b authored 作者: --global's avatar --global

Fix comparison between ssize_t and size_t

上级 7f5f1f8e
...@@ -51,14 +51,18 @@ class GpuSubtensor(HideC, Subtensor): ...@@ -51,14 +51,18 @@ class GpuSubtensor(HideC, Subtensor):
else { else {
if (*start < 0) *start += len; if (*start < 0) *start += len;
if (*start < 0) *start = (*step < 0) ? -1 : 0; if (*start < 0) *start = (*step < 0) ? -1 : 0;
if (*start >= len) *start = (*step < 0) ? len-1 : len; if (*start > -1 && *start >= len) {
*start = (*step < 0) ? len-1 : len;
}
} }
if (stop_n) *stop = (*step < 0) ? -1 : len; if (stop_n) *stop = (*step < 0) ? -1 : len;
else { else {
if (*stop < 0) *stop += len; if (*stop < 0) *stop += len;
if (*stop < 0) *stop = (*step < 0) ? -1 : 0; if (*stop < 0) *stop = (*step < 0) ? -1 : 0;
if (*stop >= len) *stop = (*step < 0) ? len-1 : len; if (*stop > -1 && *stop >= len) {
*stop = (*step < 0) ? len-1 : len;
}
} }
if (*stop < *start && *step > 0) if (*stop < *start && *step > 0)
*stop = *start; *stop = *start;
...@@ -149,7 +153,7 @@ class GpuSubtensor(HideC, Subtensor): ...@@ -149,7 +153,7 @@ class GpuSubtensor(HideC, Subtensor):
return sio.getvalue() return sio.getvalue()
def c_code_cache_version(self): def c_code_cache_version(self):
return (5,) return (6,)
class GpuIncSubtensor(IncSubtensor): class GpuIncSubtensor(IncSubtensor):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论