profile
viewpoint

Ask questionsTensors created using TFloat16.tensorOf does not have correct output

<em>Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template</em>

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Mac
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): source
  • TensorFlow version (use command below): 2.2.0
  • Python version:3.6
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

You can collect some of this information using our environment capture script You can also obtain the TensorFlow version with python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"

Describe the current behavior Tensor created using TFloat16.tensorOf does not have correct value. In example below float has value [0, 1] but TFloat16 generate values [0,0] whereas TFloat32 gives correct value [0, 1] Describe the expected behavior

Code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. public class Test {

public static void main(String[] args) {
	float[][] f1 = {{0}, {1}};
	

    System.out.println(StdArrays.ndCopyOf(f1).getFloat(0,0));
    System.out.println(StdArrays.ndCopyOf(f1).getFloat(1,0));
    
	System.out.println("FLOAT16");
    Tensor<TFloat16> tf_float1 = TFloat16.tensorOf(StdArrays.ndCopyOf(f1));
    System.out.println(tf_float1.data().getFloat(0,0));
    System.out.println(tf_float1.data().getFloat(1,0));
    
    System.out.println("FLOAT32");
    Tensor<TFloat32> tf_float2 = TFloat32.tensorOf(StdArrays.ndCopyOf(f1));
    System.out.println(tf_float2.data().getFloat(0,0));
    System.out.println(tf_float2.data().getFloat(1,0));
}

}

OUTPUT 0.0 1.0 FLOAT16 Warning: Could not load Loader: java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path Warning: Could not load Pointer: java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path Warning: Could not load BytePointer: java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path 0.0 0.0 FLOAT32 0.0 1.0 Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

tensorflow/java

Answer questions vissood

Thanks @karllessard Verified the fix #62 and it is working fine. Thanks a lot

useful!

Related questions

No questions were found.
Github User Rank List