Ewan

Results 4 comments of Ewan

Thank you for your response. What you mean is to set `ai.djl.pytorch.engine.PtNDArray#toByteBuffer` to return a DirectBuffer. I had considered this idea initially, but the current framework defaults to it being...

Regarding the byte order issue you mentioned, I observed that in the ONNX Runtime engine, the byte order is set at the Java level: ```java /* * Class: ai_onnxruntime_OnnxTensor *...

@frankfliu You're right, there was indeed a problem with my previous approach. ```cpp JNIEXPORT jobject JNICALL Java_ai_djl_pytorch_jni_PyTorchLibrary_torchDirectByteBuffer(JNIEnv* env, jobject jthis, jlong jhandle) API_BEGIN() const auto* tensor_ptr = reinterpret_cast(jhandle); // sparse...

@frankfliu Your modifications still have certain issues. - Firstly, in the function `JNIEXPORT jobject JNICALL Java_ai_djl_pytorch_jni_PyTorchLibrary_torchDirectByteBuffer`, ``` void* data_ptr = tensor.data_ptr(); if (tensor_ptr->is_sparse() || tensor_ptr->is_mkldnn() || !tensor_ptr->is_contiguous()) { // We...