Skip to content

Commit

Permalink
revert cpp change
Browse files Browse the repository at this point in the history
  • Loading branch information
KexinFeng committed Oct 10, 2022
1 parent b6722db commit 13c65d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ JNIEXPORT void JNICALL Java_ai_djl_paddlepaddle_jni_PaddleLibrary_loadExtraDir(
int size = vec_arg.size();
argv.reserve(vec_arg.size());
for (auto& arg : vec_arg) {
argv.emplace_back(const_cast<char*>(arg.data()));
argv.push_back(const_cast<char*>(arg.data()));
}
char** array = argv.data();
std::cout << "Pending Paddle fix to proceed with the option" << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ JNIEXPORT jlongArray JNICALL Java_ai_djl_pytorch_jni_PyTorchLibrary_moduleGetPar
auto* module_ptr = reinterpret_cast<torch::jit::script::Module*>(jhandle);
std::vector<jlong> jptrs;
for (const auto& tensor : module_ptr->parameters()) {
jptrs.emplace_back(reinterpret_cast<uintptr_t>(new torch::Tensor(tensor)));
jptrs.push_back(reinterpret_cast<uintptr_t>(new torch::Tensor(tensor)));
}
size_t len = jptrs.size();
jlongArray jarray = env->NewLongArray(len);
Expand All @@ -277,7 +277,7 @@ JNIEXPORT jobjectArray JNICALL Java_ai_djl_pytorch_jni_PyTorchLibrary_moduleGetP
auto* module_ptr = reinterpret_cast<torch::jit::script::Module*>(jhandle);
std::vector<std::string> jptrs;
for (const auto& named_tensor : module_ptr->named_parameters()) {
jptrs.emplace_back(named_tensor.name);
jptrs.push_back(named_tensor.name);
}
return djl::utils::jni::GetStringArrayFromVec(env, jptrs);
API_END_RETURN()
Expand Down

0 comments on commit 13c65d3

Please sign in to comment.