8
8
9
9
package org .pytorch .executorch ;
10
10
11
+ import android .util .Log ;
11
12
import com .facebook .jni .HybridData ;
12
13
import com .facebook .jni .annotations .DoNotStrip ;
13
14
import java .nio .Buffer ;
@@ -630,14 +631,17 @@ public String toString() {
630
631
}
631
632
}
632
633
633
- static class Tensor_unknown extends Tensor {
634
+ static class Tensor_unsupported extends Tensor {
634
635
private final ByteBuffer data ;
635
636
private final DType myDtype ;
636
637
637
- private Tensor_unknown (ByteBuffer data , long [] shape , DType dtype ) {
638
+ private Tensor_unsupported (ByteBuffer data , long [] shape , DType dtype ) {
638
639
super (shape );
639
640
this .data = data ;
640
641
this .myDtype = dtype ;
642
+ Log .e (
643
+ "ExecuTorch" ,
644
+ toString () + " in Java. Please consider re-export the model with proper return type" );
641
645
}
642
646
643
647
@ Override
@@ -647,7 +651,8 @@ public DType dtype() {
647
651
648
652
@ Override
649
653
public String toString () {
650
- return String .format ("Tensor(%s, dtype=%d)" , Arrays .toString (shape ), this .myDtype );
654
+ return String .format (
655
+ "Unsupported tensor(%s, dtype=%d)" , Arrays .toString (shape ), this .myDtype );
651
656
}
652
657
}
653
658
@@ -696,7 +701,7 @@ private static Tensor nativeNewTensor(
696
701
} else if (DType .INT8 .jniCode == dtype ) {
697
702
tensor = new Tensor_int8 (data , shape );
698
703
} else {
699
- tensor = new Tensor_unknown (data , shape , dtype );
704
+ tensor = new Tensor_unsupported (data , shape , DType . fromJniCode ( dtype ) );
700
705
}
701
706
tensor .mHybridData = hybridData ;
702
707
return tensor ;
0 commit comments