File tree Expand file tree Collapse file tree
extension/android/executorch_android/src/main/java/org/pytorch/executorch Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -630,6 +630,27 @@ public String toString() {
630630 }
631631 }
632632
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+
633654 // region checks
634655 private static void checkArgument (boolean expression , String errorMessage , Object ... args ) {
635656 if (!expression ) {
@@ -675,7 +696,7 @@ private static Tensor nativeNewTensor(
675696 } else if (DType .INT8 .jniCode == dtype ) {
676697 tensor = new Tensor_int8 (data , shape );
677698 } else {
678- throw new IllegalArgumentException ( "Unknown Tensor dtype" );
699+ tensor = new Tensor_unknown ( data , shape , dtype );
679700 }
680701 tensor .mHybridData = hybridData ;
681702 return tensor ;
You can’t perform that action at this time.
0 commit comments