uber / neuropod

A uniform interface to run deep learning models from multiple frameworks
https://neuropod.ai
Apache License 2.0
936 stars 77 forks source link

Support StringTensor as model output in Neuropod JNI #515

Closed voe09 closed 3 years ago

voe09 commented 3 years ago

Summary:

In neuropod JNI, it does not support STRING_TENSOR as model output. The reason is when it tries to create a Java Tensor from model output, it would check the tensor type. Only numerical tensors are supported and these tensors would be converted to ByteBuffer. However, Java NeuropodTensor itself do support STRING_TENSOR. It can get strings from the tensor data itself. Thus we refactor nativeGetBuffer method. This method would assign a null buffer to bytebuffer if it is a string tensor

Test Plan:

Unit test

CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

voe09 commented 3 years ago

Hi @VivekPanyam could you help take a look at the diff. I have rebased the master branch and all CI passed. Thanks!

VivekPanyam commented 3 years ago

None of the Linux CI has passed yet, but just unblocked it so it should be running now. Will merge once CI passes :)

codecov[bot] commented 3 years ago

Codecov Report

Merging #515 (5809213) into master (62d298b) will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #515      +/-   ##
==========================================
+ Coverage   87.27%   87.29%   +0.01%     
==========================================
  Files         111      111              
  Lines        7303     7310       +7     
==========================================
+ Hits         6374     6381       +7     
  Misses        929      929              
Impacted Files Coverage Δ
...rc/main/java/com/uber/neuropod/NeuropodTensor.java 86.84% <100.00%> (+0.35%) :arrow_up:
...rc/main/native/com_uber_neuropod_NeuropodTensor.cc 72.26% <100.00%> (+1.05%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 62d298b...5809213. Read the comment docs.