Skip to content

Commit 76dc804

Browse files
committed
fix: Fix how ITensorList is detected
Signed-off-by: Dheeraj Peri <[email protected]>
1 parent 8fc0730 commit 76dc804

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

core/conversion/var/Var.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,15 @@ bool Var::isITensor() const {
147147
}
148148

149149
bool Var::isITensorList() {
150-
if (isList() && ptr_.ivalue->isCustomClass()) {
151-
return true;
152-
} else {
153-
return false;
150+
// Unpack the Var as a List and check if each entry is a custom class since
151+
// ITensors are stored in CustomClassHolder
152+
auto ival_list = ptr_.ivalue->toList();
153+
for (int i = 0; i < ival_list.size(); i++) {
154+
if (!ival_list.get(i).isCustomClass()) {
155+
return false;
156+
}
154157
}
158+
return true;
155159
}
156160

157161
std::vector<nvinfer1::ITensor*> Var::unwrapToITensorList() {

0 commit comments

Comments
 (0)