File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
extension/android/executorch_android/src/main/java/org/pytorch/executorch Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -630,6 +630,27 @@ public String toString() {
630
630
}
631
631
}
632
632
633
+ static class Tensor_unknown extends Tensor {
634
+ private final ByteBuffer data ;
635
+ private final DType myDtype ;
636
+
637
+ private Tensor_raw_data_16b (ByteBuffer data , long [] shape , DType dtype ) {
638
+ super (shape );
639
+ this .data = data ;
640
+ this .myDtype = dtype ;
641
+ }
642
+
643
+ @ Override
644
+ public DType dtype () {
645
+ return myDtype ;
646
+ }
647
+
648
+ @ Override
649
+ public String toString () {
650
+ return String .format ("Tensor(%s, dtype=%d)" , Arrays .toString (shape ), this .myDtype );
651
+ }
652
+ }
653
+
633
654
// region checks
634
655
private static void checkArgument (boolean expression , String errorMessage , Object ... args ) {
635
656
if (!expression ) {
@@ -675,7 +696,7 @@ private static Tensor nativeNewTensor(
675
696
} else if (DType .INT8 .jniCode == dtype ) {
676
697
tensor = new Tensor_int8 (data , shape );
677
698
} else {
678
- throw new IllegalArgumentException ( "Unknown Tensor dtype" );
699
+ tensor = new Tensor_unknown ( data , shape , dtype );
679
700
}
680
701
tensor .mHybridData = hybridData ;
681
702
return tensor ;
You can’t perform that action at this time.
0 commit comments