fix PyArrayDescr_Proxy

This commit is contained in:
Dun Liang 2020-12-16 19:56:19 +08:00
parent d2c5d04ecf
commit bb562728d3
5 changed files with 8 additions and 4 deletions

View File

@ -7,7 +7,7 @@
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# ***************************************************************
__version__ = '1.2.2.7'
__version__ = '1.2.2.8'
from . import lock
with lock.lock_scope():
ori_int = int

View File

@ -952,7 +952,8 @@ pyjt_gen_src = pyjt_compiler.compile(cache_path, jittor_path)
# 3. op_utils
# 4. other
files2 = pyjt_gen_src
files4 = run_cmd('find -L src | grep "c[cu]$"', jittor_path).splitlines()
grep_args = '"c[cu]$"' if has_cuda else '"cc$"'
files4 = run_cmd('find -L src | grep '+grep_args, jittor_path).splitlines()
at_beginning = [
"src/ops/op_utils.cc",
"src/event_queue.cc",

View File

@ -1 +1 @@
84596508776983dce645fc4ef77c7f35700549d5
d2eb452b81e704188346a788d8d53889f7b12007

View File

@ -6,9 +6,11 @@
#include <cfloat>
#include <cmath>
#include "misc/nan_checker.h"
#ifdef HAS_CUDA
#include "misc/cuda_flags.h"
#include <cuda_runtime.h>
#include "helper_cuda.h"
#endif
#include "mem/allocator.h"
#include "op.h"

View File

@ -736,7 +736,8 @@ void load_var_slice(PyObject* obj, T* var_slice, vector<unique_ptr<VarHolder>>&
var_slice->set_none();
} else
if (PyObject_TypeCheck(obj, PyNumberArrType_Type)) {
PyArrayDescr_Proxy array_descr = {.type_num = 5}; // 5: int32
PyArrayDescr_Proxy array_descr;
array_descr.type_num = 5; // 5: int32
int value;
PyArray_CastScalarToCtype(obj, &value, &array_descr);
var_slice->set_int(value);