bool slice check

This commit is contained in:
Dun Liang 2021-03-05 12:04:40 +08:00
parent 6b9bfef1da
commit 0d94663dee
3 changed files with 5 additions and 2 deletions

View File

@ -8,7 +8,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.35'
__version__ = '1.2.2.36'
from . import lock
with lock.lock_scope():
ori_int = int

View File

@ -745,7 +745,9 @@ void load_var_slice(PyObject* obj, T* var_slice, vector<unique_ptr<VarHolder>>&
} else {
holders.emplace_back();
auto* vh = from_py_object<VarHolder*>(obj, holders.back());
auto vv = (Var**)vh;
auto vv = (decltype(var_slice->var)*)vh;
CHECK(vv[0]->dtype() != ns_bool) << "Please convert bool slice into jt.array, example:\n"
"a[[True,False,False]] ---> a[jt.array([True,False,False])";
var_slice->set_var(vv[0]);
}
}

View File

@ -7,6 +7,7 @@
#pragma once
#include "common.h"
#include "misc/nano_vector.h"
#include "var.h"
namespace jittor {