File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -384,6 +384,11 @@ EValue to_evalue(val v) {
384384 return EValue (v.as <int64_t >());
385385 } else if (type_str == " object" ) {
386386 // If it is an object, assume it is a tensor.
387+ THROW_IF_FALSE (
388+ v.instanceof
389+ (val::module_property (" Tensor" )),
390+ " Received non-tensor object: %s" ,
391+ val::global (" JSON" ).call <std::string>(" stringify" , v).c_str ());
387392 return EValue (v.as <JsTensor&>().get_tensor ());
388393 }
389394 THROW_JS_ERROR (
@@ -696,9 +701,10 @@ EMSCRIPTEN_BINDINGS(WasmBindings) {
696701// Additionally, different enums of the same type are considered to be equal.
697702// Assigning the name field fixes both of these issues.
698703#define JS_ASSIGN_SCALAR_TYPE_NAME (T, NAME ) \
699- EM_ASM (Module. ScalarType . NAME . name = #NAME);
704+ val::module_property ( " ScalarType" )[# NAME]. set ( " name" , #NAME);
700705 JS_FORALL_SUPPORTED_TENSOR_TYPES (JS_ASSIGN_SCALAR_TYPE_NAME)
701- #define JS_ASSIGN_TAG_NAME (NAME ) EM_ASM(Module.Tag.NAME.name = #NAME);
706+ #define JS_ASSIGN_TAG_NAME (NAME ) \
707+ val::module_property (" Tag" )[#NAME].set (" name" , #NAME);
702708 EXECUTORCH_FORALL_TAGS (JS_ASSIGN_TAG_NAME)
703709}
704710
You can’t perform that action at this time.
0 commit comments