Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/runtime/vm/builtin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,13 @@ TVM_FFI_STATIC_INIT_BLOCK() {
* \sa MatchShapeCode
*/
void MatchShape(ffi::PackedArgs args, ffi::Any* rv) {
// input shape the first argument can take in tensor or shape.
// input shape the first argument can take in tensor, DLTensor* or shape.
ffi::Shape input_shape;
if (auto opt_nd = args[0].as<Tensor>()) {
input_shape = opt_nd.value().Shape();
if (auto opt_tensor = args[0].as<Tensor>()) {
input_shape = opt_tensor.value().Shape();
} else if (auto opt_dltensor = args[0].try_cast<DLTensor*>()) {
DLTensor* ptr = opt_dltensor.value();
input_shape = ffi::Shape(ptr->shape, ptr->shape + ptr->ndim);
} else {
input_shape = args[0].cast<ffi::Shape>();
}
Expand Down