From 0d14032d26c6f25bd93476a079d70701227e89a0 Mon Sep 17 00:00:00 2001 From: Fariz Rahman Date: Wed, 4 Dec 2019 11:41:03 +0530 Subject: [PATCH] TF Updates (#87) * tf updates * pom * copyright * graphrunner tests * gpu test * getSessionOptionsConfigProto * dtype fix * Small fix Signed-off-by: AlexDBlack * cast graphs * savemodel test fix * testresource instead of local * Logging level Signed-off-by: AlexDBlack * gson dependency issue fix; fix GraphRunnerTest for no session options config case Signed-off-by: Alex Black * Final tweaks Signed-off-by: AlexDBlack * few minor fixes Signed-off-by: raver119 * one more fix Signed-off-by: raver119 * Tweak configuration for GraphRunnerTest Signed-off-by: AlexDBlack * nd4j align config * tf warmup --- .../jita/concurrency/CudaAffinityManager.java | 6 +- .../conversion/GraphRunnerTest.java | 88 +- .../conversion/GpuDeviceAlignmentTest.java | 33 - .../conversion/GpuGraphRunnerTest.java | 22 +- nd4j/nd4j-tensorflow/pom.xml | 11 + .../tensorflow/conversion/TensorDataType.java | 131 +++ .../conversion/TensorflowConversion.java | 3 +- .../conversion/graphrunner/GraphRunner.java | 880 +++++++++--------- .../main/resources/cast_graph/ai/__init__.py | 0 .../cast_graph/ai/konduit/__init__.py | 0 .../cast_graph/ai/konduit/casting.py | 17 + .../cast_graph/cast_float16_float16.pb | 5 + .../cast_graph/cast_float16_float32.pb | 11 + .../cast_graph/cast_float16_float64.pb | 11 + .../cast_graph/cast_float16_int16.pb | 11 + .../cast_graph/cast_float16_int32.pb | 11 + .../cast_graph/cast_float16_int64.pb | 11 + .../resources/cast_graph/cast_float16_int8.pb | 11 + .../cast_graph/cast_float16_uint16.pb | 11 + .../cast_graph/cast_float16_uint32.pb | 11 + .../cast_graph/cast_float16_uint64.pb | 11 + .../cast_graph/cast_float16_uint8.pb | 11 + .../cast_graph/cast_float32_float16.pb | 11 + .../cast_graph/cast_float32_float32.pb | 5 + .../cast_graph/cast_float32_float64.pb | 11 + .../cast_graph/cast_float32_int16.pb | 11 + .../cast_graph/cast_float32_int32.pb | 11 + .../cast_graph/cast_float32_int64.pb | 11 + .../resources/cast_graph/cast_float32_int8.pb | 11 + .../cast_graph/cast_float32_uint16.pb | 11 + .../cast_graph/cast_float32_uint32.pb | 11 + .../cast_graph/cast_float32_uint64.pb | 11 + .../cast_graph/cast_float32_uint8.pb | 11 + .../cast_graph/cast_float64_float16.pb | 11 + .../cast_graph/cast_float64_float32.pb | 11 + .../cast_graph/cast_float64_float64.pb | 5 + .../cast_graph/cast_float64_int16.pb | 11 + .../cast_graph/cast_float64_int32.pb | 11 + .../cast_graph/cast_float64_int64.pb | 11 + .../resources/cast_graph/cast_float64_int8.pb | 11 + .../cast_graph/cast_float64_uint16.pb | 11 + .../cast_graph/cast_float64_uint32.pb | 11 + .../cast_graph/cast_float64_uint64.pb | 11 + .../cast_graph/cast_float64_uint8.pb | 11 + .../cast_graph/cast_int16_float16.pb | 11 + .../cast_graph/cast_int16_float32.pb | 11 + .../cast_graph/cast_int16_float64.pb | 11 + .../resources/cast_graph/cast_int16_int16.pb | 5 + .../resources/cast_graph/cast_int16_int32.pb | 11 + .../resources/cast_graph/cast_int16_int64.pb | 11 + .../resources/cast_graph/cast_int16_int8.pb | 11 + .../resources/cast_graph/cast_int16_uint16.pb | 11 + .../resources/cast_graph/cast_int16_uint32.pb | 11 + .../resources/cast_graph/cast_int16_uint64.pb | 11 + .../resources/cast_graph/cast_int16_uint8.pb | 11 + .../cast_graph/cast_int32_float16.pb | 11 + .../cast_graph/cast_int32_float32.pb | 11 + .../cast_graph/cast_int32_float64.pb | 11 + .../resources/cast_graph/cast_int32_int16.pb | 11 + .../resources/cast_graph/cast_int32_int32.pb | 5 + .../resources/cast_graph/cast_int32_int64.pb | 11 + .../resources/cast_graph/cast_int32_int8.pb | 11 + .../resources/cast_graph/cast_int32_uint16.pb | 11 + .../resources/cast_graph/cast_int32_uint32.pb | 11 + .../resources/cast_graph/cast_int32_uint64.pb | 11 + .../resources/cast_graph/cast_int32_uint8.pb | 11 + .../cast_graph/cast_int64_float16.pb | 11 + .../cast_graph/cast_int64_float32.pb | 11 + .../cast_graph/cast_int64_float64.pb | 11 + .../resources/cast_graph/cast_int64_int16.pb | 11 + .../resources/cast_graph/cast_int64_int32.pb | 11 + .../resources/cast_graph/cast_int64_int64.pb | 5 + .../resources/cast_graph/cast_int64_int8.pb | 11 + .../resources/cast_graph/cast_int64_uint16.pb | 11 + .../resources/cast_graph/cast_int64_uint32.pb | 11 + .../resources/cast_graph/cast_int64_uint64.pb | 11 + .../resources/cast_graph/cast_int64_uint8.pb | 11 + .../resources/cast_graph/cast_int8_float16.pb | 11 + .../resources/cast_graph/cast_int8_float32.pb | 11 + .../resources/cast_graph/cast_int8_float64.pb | 11 + .../resources/cast_graph/cast_int8_int16.pb | 11 + .../resources/cast_graph/cast_int8_int32.pb | 11 + .../resources/cast_graph/cast_int8_int64.pb | 11 + .../resources/cast_graph/cast_int8_int8.pb | 5 + .../resources/cast_graph/cast_int8_uint16.pb | 11 + .../resources/cast_graph/cast_int8_uint32.pb | 11 + .../resources/cast_graph/cast_int8_uint64.pb | 11 + .../resources/cast_graph/cast_int8_uint8.pb | 11 + .../cast_graph/cast_uint16_float16.pb | 11 + .../cast_graph/cast_uint16_float32.pb | 11 + .../cast_graph/cast_uint16_float64.pb | 11 + .../resources/cast_graph/cast_uint16_int16.pb | 11 + .../resources/cast_graph/cast_uint16_int32.pb | 11 + .../resources/cast_graph/cast_uint16_int64.pb | 11 + .../resources/cast_graph/cast_uint16_int8.pb | 11 + .../cast_graph/cast_uint16_uint16.pb | 5 + .../cast_graph/cast_uint16_uint32.pb | 11 + .../cast_graph/cast_uint16_uint64.pb | 11 + .../resources/cast_graph/cast_uint16_uint8.pb | 11 + .../cast_graph/cast_uint32_float16.pb | 11 + .../cast_graph/cast_uint32_float32.pb | 11 + .../cast_graph/cast_uint32_float64.pb | 11 + .../resources/cast_graph/cast_uint32_int16.pb | 11 + .../resources/cast_graph/cast_uint32_int32.pb | 11 + .../resources/cast_graph/cast_uint32_int64.pb | 11 + .../resources/cast_graph/cast_uint32_int8.pb | 11 + .../cast_graph/cast_uint32_uint16.pb | 11 + .../cast_graph/cast_uint32_uint32.pb | 5 + .../cast_graph/cast_uint32_uint64.pb | 11 + .../resources/cast_graph/cast_uint32_uint8.pb | 11 + .../cast_graph/cast_uint64_float16.pb | 11 + .../cast_graph/cast_uint64_float32.pb | 11 + .../cast_graph/cast_uint64_float64.pb | 11 + .../resources/cast_graph/cast_uint64_int16.pb | 11 + .../resources/cast_graph/cast_uint64_int32.pb | 11 + .../resources/cast_graph/cast_uint64_int64.pb | 11 + .../resources/cast_graph/cast_uint64_int8.pb | 11 + .../cast_graph/cast_uint64_uint16.pb | 11 + .../cast_graph/cast_uint64_uint32.pb | 11 + .../cast_graph/cast_uint64_uint64.pb | 5 + .../resources/cast_graph/cast_uint64_uint8.pb | 11 + .../cast_graph/cast_uint8_float16.pb | 11 + .../cast_graph/cast_uint8_float32.pb | 11 + .../cast_graph/cast_uint8_float64.pb | 11 + .../resources/cast_graph/cast_uint8_int16.pb | 11 + .../resources/cast_graph/cast_uint8_int32.pb | 11 + .../resources/cast_graph/cast_uint8_int64.pb | 11 + .../resources/cast_graph/cast_uint8_int8.pb | 11 + .../resources/cast_graph/cast_uint8_uint16.pb | 11 + .../resources/cast_graph/cast_uint8_uint32.pb | 11 + .../resources/cast_graph/cast_uint8_uint64.pb | 11 + .../resources/cast_graph/cast_uint8_uint8.pb | 5 + 132 files changed, 1940 insertions(+), 516 deletions(-) delete mode 100644 nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/gpujava/org/nd4j/tensorflow/conversion/GpuDeviceAlignmentTest.java create mode 100644 nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorDataType.java create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/ai/__init__.py create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/ai/konduit/__init__.py create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/ai/konduit/casting.py create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int8.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint16.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint32.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint64.pb create mode 100644 nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint8.pb diff --git a/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java b/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java index cf362c460..aea78a4e0 100644 --- a/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java +++ b/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java @@ -28,6 +28,7 @@ import org.nd4j.linalg.api.concurrency.AffinityManager; import org.nd4j.linalg.api.concurrency.BasicAffinityManager; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.factory.Nd4j; +import org.nd4j.linalg.jcublas.buffer.BaseCudaDataBuffer; import org.nd4j.linalg.jcublas.context.CudaContext; import org.nd4j.nativeblas.NativeOpsHolder; import org.slf4j.Logger; @@ -298,9 +299,12 @@ public class CudaAffinityManager extends BasicAffinityManager { @Override public void ensureLocation(INDArray array, Location location) { // to location to ensure for empty array - if (array.isEmpty()) + if (array.isEmpty() || array.isS()) return; + // let's make sure host pointer actually exists + ((BaseCudaDataBuffer) array.data()).lazyAllocateHostPointer(); + val point = AtomicAllocator.getInstance().getAllocationPoint(array); switch (location) { case HOST: { diff --git a/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/cpujava/org/nd4j/tensorflow/conversion/GraphRunnerTest.java b/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/cpujava/org/nd4j/tensorflow/conversion/GraphRunnerTest.java index ee188605d..c959edbfe 100644 --- a/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/cpujava/org/nd4j/tensorflow/conversion/GraphRunnerTest.java +++ b/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/cpujava/org/nd4j/tensorflow/conversion/GraphRunnerTest.java @@ -1,5 +1,6 @@ /******************************************************************************* * Copyright (c) 2015-2018 Skymind, Inc. + * Copyright (c) 2019 Konduit K.K. * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -16,6 +17,12 @@ package org.nd4j.tensorflow.conversion; +import junit.framework.TestCase; +import org.apache.commons.io.FileUtils; +import org.bytedeco.tensorflow.TF_Tensor; +import org.nd4j.linalg.api.buffer.DataType; +import org.nd4j.resources.Resources; +import org.nd4j.shade.protobuf.Descriptors; import org.nd4j.shade.protobuf.util.JsonFormat; import org.apache.commons.io.IOUtils; import org.junit.Ignore; @@ -27,6 +34,8 @@ import org.nd4j.linalg.factory.Nd4j; import org.nd4j.linalg.io.ClassPathResource; import org.nd4j.tensorflow.conversion.graphrunner.GraphRunner; import org.nd4j.tensorflow.conversion.graphrunner.SavedModelConfig; +import org.tensorflow.framework.ConfigProto; +import org.tensorflow.framework.GPUOptions; import java.io.File; import java.util.Arrays; @@ -39,12 +48,25 @@ import static org.junit.Assert.assertNotNull; public class GraphRunnerTest { + public static ConfigProto getConfig(){ + String backend = Nd4j.getExecutioner().getEnvironmentInformation().getProperty("backend"); + if("CUDA".equalsIgnoreCase(backend)) { + org.tensorflow.framework.ConfigProto configProto = org.tensorflow.framework.ConfigProto.getDefaultInstance(); + ConfigProto.Builder b = configProto.toBuilder().addDeviceFilters(TensorflowConversion.defaultDeviceForThread()); + return b.setGpuOptions(GPUOptions.newBuilder() + .setAllowGrowth(true) + .setPerProcessGpuMemoryFraction(0.5) + .build()).build(); + } + return null; + } + @Test public void testGraphRunner() throws Exception { List inputs = Arrays.asList("input_0","input_1"); byte[] content = IOUtils.toByteArray(new ClassPathResource("/tf_graphs/nd4j_convert/simple_graph/frozen_model.pb").getInputStream()); - try(GraphRunner graphRunner = new GraphRunner(content,inputs)) { + try(GraphRunner graphRunner = GraphRunner.builder().graphBytes(content).inputNames(inputs).sessionOptionsConfigProto(getConfig()).build()) { runGraphRunnerTest(graphRunner); } } @@ -52,8 +74,9 @@ public class GraphRunnerTest { @Test public void testGraphRunnerFilePath() throws Exception { List inputs = Arrays.asList("input_0","input_1"); - File file = new ClassPathResource("/tf_graphs/nd4j_convert/simple_graph/frozen_model.pb").getFile(); - try(GraphRunner graphRunner = new GraphRunner(file.getAbsolutePath(),inputs)) { + byte[] content = FileUtils.readFileToByteArray(Resources.asFile("/tf_graphs/nd4j_convert/simple_graph/frozen_model.pb")); + + try(GraphRunner graphRunner = GraphRunner.builder().graphBytes(content).inputNames(inputs).sessionOptionsConfigProto(getConfig()).build()) { runGraphRunnerTest(graphRunner); } } @@ -62,37 +85,42 @@ public class GraphRunnerTest { public void testInputOutputResolution() throws Exception { ClassPathResource lenetPb = new ClassPathResource("tf_graphs/lenet_frozen.pb"); byte[] content = IOUtils.toByteArray(lenetPb.getInputStream()); - GraphRunner graphRunner = new GraphRunner(content,Arrays.asList("Reshape/tensor")); - assertEquals(1,graphRunner.getInputOrder().size()); - assertEquals(1,graphRunner.getOutputOrder().size()); + List inputs = Arrays.asList("Reshape/tensor"); + try(GraphRunner graphRunner = GraphRunner.builder().graphBytes(content).inputNames(inputs).sessionOptionsConfigProto(getConfig()).build()) { + assertEquals(1, graphRunner.getInputOrder().size()); + assertEquals(1, graphRunner.getOutputOrder().size()); + } } @Test @Ignore //Ignored 2019/02/05: ssd_inception_v2_coco_2019_01_28 does not exist in test resources public void testMultiOutputGraph() throws Exception { - ClassPathResource classPathResource = new ClassPathResource("/tf_graphs/examples/ssd_inception_v2_coco_2018_01_28/frozen_inference_graph.pb"); - GraphRunner graphRunner = new GraphRunner(classPathResource.getFile().getAbsolutePath(),Arrays.asList("image_tensor")); - String[] outputs = new String[] { "detection_boxes", "detection_scores", "detection_classes", "num_detections"}; + List inputs = Arrays.asList("image_tensor"); + byte[] content = IOUtils.toByteArray(new ClassPathResource("/tf_graphs/examples/ssd_inception_v2_coco_2018_01_28/frozen_inference_graph.pb").getInputStream()); + try(GraphRunner graphRunner = GraphRunner.builder().graphBytes(content).inputNames(inputs).sessionOptionsConfigProto(getConfig()).build()) { + String[] outputs = new String[]{"detection_boxes", "detection_scores", "detection_classes", "num_detections"}; - assertEquals(1,graphRunner.getInputOrder().size()); - System.out.println(graphRunner.getOutputOrder()); - assertEquals(4,graphRunner.getOutputOrder().size()); + assertEquals(1, graphRunner.getInputOrder().size()); + System.out.println(graphRunner.getOutputOrder()); + assertEquals(4, graphRunner.getOutputOrder().size()); + } } private void runGraphRunnerTest(GraphRunner graphRunner) throws Exception { - - org.tensorflow.framework.ConfigProto.Builder builder = org.tensorflow.framework.ConfigProto.newBuilder(); String json = graphRunner.sessionOptionsToJson(); - JsonFormat.parser().merge(json,builder); - org.tensorflow.framework.ConfigProto build = builder.build(); - assertEquals(build,graphRunner.getProtoBufConfigProto()); + if( json != null ) { + org.tensorflow.framework.ConfigProto.Builder builder = org.tensorflow.framework.ConfigProto.newBuilder(); + JsonFormat.parser().merge(json, builder); + org.tensorflow.framework.ConfigProto build = builder.build(); + assertEquals(build,graphRunner.getSessionOptionsConfigProto()); + } assertNotNull(graphRunner.getInputOrder()); assertNotNull(graphRunner.getOutputOrder()); - org.tensorflow.framework.ConfigProto configProto1 = GraphRunner.fromJson(json); + org.tensorflow.framework.ConfigProto configProto1 = json == null ? null : GraphRunner.fromJson(json); - assertEquals(graphRunner.getProtoBufConfigProto(),configProto1); + assertEquals(graphRunner.getSessionOptionsConfigProto(),configProto1); assertEquals(2,graphRunner.getInputOrder().size()); assertEquals(1,graphRunner.getOutputOrder().size()); @@ -125,15 +153,31 @@ public class GraphRunnerTest { .signatureKey("incr_counter_by") .modelTag("serve") .build(); - try(GraphRunner graphRunner = new GraphRunner(savedModelConfig)) { + try(GraphRunner graphRunner = GraphRunner.builder().savedModelConfig(savedModelConfig).sessionOptionsConfigProto(getConfig()).build()) { INDArray delta = Nd4j.create(new float[] { 42 }, new long[0]); Map inputs = new LinkedHashMap<>(); - inputs.put("delta",delta); + inputs.put("delta:0",delta); Map outputs = graphRunner.run(inputs); assertEquals(1, outputs.size()); - INDArray output = outputs.get("output"); + System.out.println(Arrays.toString(outputs.keySet().toArray(new String[0]))); + INDArray output = outputs.values().toArray(new INDArray[0])[0]; assertEquals(42.0, output.getDouble(0), 0.0); } } + @Test + public void testGraphRunnerCast() { + INDArray arr = Nd4j.linspace(1,4,4).castTo(DataType.FLOAT); + TF_Tensor tensor = TensorflowConversion.getInstance().tensorFromNDArray(arr); + TF_Tensor tf_tensor = GraphRunner.castTensor(tensor, TensorDataType.FLOAT,TensorDataType.DOUBLE); + INDArray doubleNDArray = TensorflowConversion.getInstance().ndArrayFromTensor(tf_tensor); + TestCase.assertEquals(DataType.DOUBLE,doubleNDArray.dataType()); + + arr = arr.castTo(DataType.INT); + tensor = TensorflowConversion.getInstance().tensorFromNDArray(arr); + tf_tensor = GraphRunner.castTensor(tensor, TensorDataType.fromNd4jType(DataType.INT),TensorDataType.DOUBLE); + doubleNDArray = TensorflowConversion.getInstance().ndArrayFromTensor(tf_tensor); + TestCase.assertEquals(DataType.DOUBLE,doubleNDArray.dataType()); + + } } diff --git a/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/gpujava/org/nd4j/tensorflow/conversion/GpuDeviceAlignmentTest.java b/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/gpujava/org/nd4j/tensorflow/conversion/GpuDeviceAlignmentTest.java deleted file mode 100644 index ef3aaa872..000000000 --- a/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/gpujava/org/nd4j/tensorflow/conversion/GpuDeviceAlignmentTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015-2018 Skymind, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ******************************************************************************/ - -package org.nd4j.tensorflow.conversion; - -import org.junit.Test; -import org.nd4j.tensorflow.conversion.graphrunner.GraphRunner; -import org.tensorflow.framework.ConfigProto; - -import static junit.framework.TestCase.assertTrue; - -public class GpuDeviceAlignmentTest { - - @Test - public void testDeviceAlignment() { - ConfigProto configProto = GraphRunner.getAlignedWithNd4j(); - assertTrue(configProto.getDeviceFilters(0).contains("gpu")); - } - -} diff --git a/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/gpujava/org/nd4j/tensorflow/conversion/GpuGraphRunnerTest.java b/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/gpujava/org/nd4j/tensorflow/conversion/GpuGraphRunnerTest.java index 1ecc0e39a..614330813 100644 --- a/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/gpujava/org/nd4j/tensorflow/conversion/GpuGraphRunnerTest.java +++ b/nd4j/nd4j-backends/nd4j-tests-tensorflow/src/test/gpujava/org/nd4j/tensorflow/conversion/GpuGraphRunnerTest.java @@ -1,5 +1,6 @@ -/******************************************************************************* +/* ****************************************************************************** * Copyright (c) 2015-2018 Skymind, Inc. + * Copyright (c) 2019 Konduit K.K. * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -18,7 +19,6 @@ package org.nd4j.tensorflow.conversion; import org.nd4j.shade.protobuf.util.JsonFormat; import org.apache.commons.io.IOUtils; -import org.junit.Ignore; import org.junit.Test; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.factory.Nd4j; @@ -28,6 +28,7 @@ import org.tensorflow.framework.ConfigProto; import org.tensorflow.framework.GPUOptions; import java.io.File; +import java.io.FileInputStream; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; @@ -36,34 +37,34 @@ import java.util.Map; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -@Ignore("AB 2019/05/24 - Failing on CI - no jnitensorflow in java.library.path - see issue #7657") public class GpuGraphRunnerTest { @Test public void testGraphRunner() throws Exception { - File f = new ClassPathResource("/tf_graphs/nd4j_convert/simple_graph/frozen_model.pb").getFile(); + byte[] content = IOUtils.toByteArray(new FileInputStream(new File("C:\\Users\\fariz\\code\\dl4j-test-resources\\src\\main\\resources\\tf_graphs\\nd4j_convert\\simple_graph\\frozen_model.pb"))); + //byte[] content = IOUtils.toByteArray(new ClassPathResource("/tf_graphs/nd4j_convert/simple_graph/frozen_model.pb").getInputStream()); List inputNames = Arrays.asList("input_0","input_1"); ConfigProto configProto = ConfigProto.newBuilder() .setGpuOptions(GPUOptions.newBuilder() - .setPerProcessGpuMemoryFraction(0.01) + .setPerProcessGpuMemoryFraction(0.1) .setAllowGrowth(false) .build()) .build(); - try(GraphRunner graphRunner = new GraphRunner(f.getAbsolutePath(), inputNames, configProto)) { + try(GraphRunner graphRunner = GraphRunner.builder().graphBytes(content).inputNames(inputNames).sessionOptionsConfigProto(configProto).build()) { org.tensorflow.framework.ConfigProto.Builder builder = org.tensorflow.framework.ConfigProto.newBuilder(); String json = graphRunner.sessionOptionsToJson(); JsonFormat.parser().merge(json,builder); org.tensorflow.framework.ConfigProto build = builder.build(); - assertEquals(build,graphRunner.getProtoBufConfigProto()); + assertEquals(build,graphRunner.getSessionOptionsConfigProto()); assertNotNull(graphRunner.getInputOrder()); assertNotNull(graphRunner.getOutputOrder()); org.tensorflow.framework.ConfigProto configProto1 = GraphRunner.fromJson(json); - assertEquals(graphRunner.getProtoBufConfigProto(),configProto1); + assertEquals(graphRunner.getSessionOptionsConfigProto(),configProto1); assertEquals(2,graphRunner.getInputOrder().size()); assertEquals(1,graphRunner.getOutputOrder().size()); @@ -83,9 +84,4 @@ public class GpuGraphRunnerTest { } } - - - - - } diff --git a/nd4j/nd4j-tensorflow/pom.xml b/nd4j/nd4j-tensorflow/pom.xml index ea9edd08f..fb859a95f 100644 --- a/nd4j/nd4j-tensorflow/pom.xml +++ b/nd4j/nd4j-tensorflow/pom.xml @@ -45,9 +45,20 @@ tensorflow ${tensorflow.javacpp.version} + + org.bytedeco + tensorflow-platform + ${tensorflow.javacpp.version} + + + com.google.code.gson + gson + ${gson.version} + junit junit + test diff --git a/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorDataType.java b/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorDataType.java new file mode 100644 index 000000000..74d053547 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorDataType.java @@ -0,0 +1,131 @@ +/* ****************************************************************************** + * Copyright (c) 2015-2018 Skymind, Inc. + * Copyright (c) 2019 Konduit K.K. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ******************************************************************************/ + +package org.nd4j.tensorflow.conversion; + +import org.nd4j.linalg.api.buffer.DataType; +import org.nd4j.linalg.api.ndarray.INDArray; +import org.nd4j.linalg.compression.CompressedDataBuffer; +import org.nd4j.linalg.compression.CompressionDescriptor; + +public enum TensorDataType { + INVALID, + FLOAT, + DOUBLE, + INT32, + UINT8, + INT16, + INT8, + STRING, + COMPLEX64, + INT64, + BOOL, + QINT8, + QUINT8, + QINT32, + BFLOAT16, + QINT16, + QUINT16, + UINT16, + COMPLEX128, + HALF, + RESOURCE, + VARIANT, + UINT32, + UINT64; + + + /** + * Map a tensor data type to a proto value found in tensorflow. + * Generally, this is just replacing DT_ with empty + * and returning enum.valueOf(string) + * @param value the input string + * @return the associated {@link TensorDataType} + */ + public static TensorDataType fromProtoValue(String value) { + String valueReplace = value.replace("DT_",""); + return TensorDataType.valueOf(valueReplace); + } + + + + /** + * Get the python name for the given data type + * @param tensorDataType the python name for the given data type + * @return float64 for double, float32 for double, float16 for half, otherwise + * the type's name converted to lower case + */ + public static String toPythonName(TensorDataType tensorDataType) { + switch(tensorDataType) { + case DOUBLE: return "float64"; + case FLOAT: return "float32"; + case HALF: return "float16"; + + default: return tensorDataType.name().toLowerCase(); + } + } + + public static DataType toNd4jType(TensorDataType tensorDataType) { + switch(tensorDataType) { + case FLOAT: return DataType.FLOAT; + case DOUBLE: return DataType.DOUBLE; + case BOOL: return DataType.BOOL; + case INT32: return DataType.INT; + case INT64: return DataType.LONG; + case STRING: return DataType.UTF8; + case HALF: return DataType.HALF; + default: throw new IllegalArgumentException("Unsupported type " + tensorDataType.name()); + } + } + + + public static TensorDataType fromNd4jType(DataType dataType) { + switch(dataType) { + case FLOAT: return TensorDataType.FLOAT; + case LONG: return TensorDataType.INT64; + case INT: return TensorDataType.INT32; + case BOOL: return TensorDataType.BOOL; + case DOUBLE: return TensorDataType.DOUBLE; + case HALF: return TensorDataType.HALF; + case UTF8: return TensorDataType.STRING; + case COMPRESSED: throw new IllegalStateException("Unable to work with compressed data type. Could be 1 or more types."); + case SHORT: return TensorDataType.INT16; + default: throw new IllegalArgumentException("Unknown data type " + dataType); + } + } + + public static TensorDataType fromNd4jType(INDArray array) { + DataType dataType = array.dataType(); + switch(dataType) { + case COMPRESSED: + CompressedDataBuffer compressedData = (CompressedDataBuffer) array.data(); + CompressionDescriptor desc = compressedData.getCompressionDescriptor(); + String algo = desc.getCompressionAlgorithm(); + switch (algo) { + case "FLOAT16": return HALF; + case "INT8": return INT8; + case "UINT8": return UINT8; + case "INT16": return INT16; + case "UINT16": return UINT16; + default: throw new IllegalArgumentException("Unsupported compression algorithm: " + algo); + } + + default: return fromNd4jType(dataType); + } + } + +} diff --git a/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorflowConversion.java b/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorflowConversion.java index 6eff18ecc..82c9b947e 100644 --- a/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorflowConversion.java +++ b/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorflowConversion.java @@ -239,7 +239,8 @@ public class TensorflowConversion { DataBuffer d = Nd4j.createBuffer(indexer.pointer(),nd4jType,length,indexer); array = Nd4j.create(d,ndShape); } - Nd4j.getAffinityManager().tagLocation(array, AffinityManager.Location.HOST); + // we don't need this in this case. Device memory will be updated right in the constructor + //Nd4j.getAffinityManager().tagLocation(array, AffinityManager.Location.HOST); return array; } diff --git a/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/graphrunner/GraphRunner.java b/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/graphrunner/GraphRunner.java index 79d45f781..9cb0a609b 100644 --- a/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/graphrunner/GraphRunner.java +++ b/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/graphrunner/GraphRunner.java @@ -16,26 +16,32 @@ package org.nd4j.tensorflow.conversion.graphrunner; +import lombok.Builder; +import lombok.Singular; +import org.apache.commons.io.FileUtils; +import org.nd4j.base.Preconditions; +import org.nd4j.linalg.factory.Nd4j; +import org.nd4j.linalg.io.ClassPathResource; +import org.nd4j.linalg.primitives.Pair; import org.nd4j.shade.protobuf.ByteString; import org.nd4j.shade.protobuf.InvalidProtocolBufferException; import org.nd4j.shade.protobuf.util.JsonFormat; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; +import org.nd4j.tensorflow.conversion.TensorDataType; import org.apache.commons.io.IOUtils; import org.bytedeco.javacpp.BytePointer; import org.bytedeco.javacpp.PointerPointer; import org.nd4j.linalg.api.ndarray.INDArray; -import org.nd4j.linalg.factory.Nd4j; import org.nd4j.tensorflow.conversion.TensorflowConversion; import org.tensorflow.framework.ConfigProto; -import org.tensorflow.framework.GPUOptions; import org.tensorflow.framework.NodeDef; -import java.io.Closeable; -import java.io.File; -import java.io.IOException; +import java.io.*; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; import org.bytedeco.tensorflow.*; import static org.bytedeco.tensorflow.global.tensorflow.*; @@ -51,10 +57,13 @@ import static org.bytedeco.tensorflow.global.tensorflow.*; */ @Slf4j public class GraphRunner implements Closeable { + + private static boolean isTfWarmedUp = false; + private static boolean isTfWarmingUp = false; private SavedModelConfig savedModelConfig; //the in memory representation parsed from protobuf private TF_Graph graph; - //the conversion between nd4j and tensorflow + //the conversion between nd4j and TensorFlow private TensorflowConversion conversion = TensorflowConversion.getInstance(); //a persistent session to be used when running the graph private TF_Session session; @@ -64,170 +73,104 @@ public class GraphRunner implements Closeable { private TF_Status status; @Getter @Setter + @Singular private List inputOrder,outputOrder; @Getter - private org.tensorflow.framework.ConfigProto protoBufConfigProto; + private org.tensorflow.framework.ConfigProto sessionOptionsConfigProto; + @Getter + @Setter + @Singular + private Map inputDataTypes,outputDataTypes; + private static Map,GraphRunner> recastGraphDefs; - /** - * Pass in a graph instance and - * the length of the protobuf - * that it was instantiated with. - * For files this is typically - * {@link File#length()}, - * for byte arrays, this is - * byte array.length - * and for {@link java.nio.ByteBuffer} - * this would be something like the - * {@link java.nio.ByteBuffer#capacity()} - * @param inputNames the input names for the graph - * @param outputNames the output names in the graph - * @param graph a pointer to the {@link TF_Graph} to use when executing - * @param graphDef {@link org.tensorflow.framework.GraphDef} protobuf - * definition containing - * the graph configuration - * for automatically inferring - * things like - * graph inputs and outputs - * - * - */ - public GraphRunner(List inputNames,List outputNames,TF_Graph graph,org.tensorflow.framework.GraphDef graphDef) { - this(inputNames,outputNames,graph,graphDef,null); - - } - - /** - * Pass in a graph instance and - * the length of the protobuf - * that it was instantiated with. - * For files this is typically - * {@link File#length()}, - * for byte arrays, this is - * byte array.length - * and for {@link java.nio.ByteBuffer} - * this would be something like the - * {@link java.nio.ByteBuffer#capacity()} - * @param graph a pointer to the {@link TF_Graph} to use when executing - * @param graphDef {@link org.tensorflow.framework.GraphDef} protobuf - * definition containing - * the graph configuration - * for automatically inferring - * things like - * graph inputs and outputs - * @param configProto the session configuration proto to use with this runner - */ - public GraphRunner(List inputNames,List outputNames,TF_Graph graph,org.tensorflow.framework.GraphDef graphDef,ConfigProto configProto) { - this.graph = graph; - this.protoBufConfigProto = configProto; - this.inputOrder = inputNames; - this.outputOrder = outputNames; - initSessionAndStatusIfNeeded(graphDef); - - } - - /** - * Initialize with the graph content to use - * @param inputNames the inputs to the graph - * @param graphToUse the raw byte content - * of a protobuf file saved by tensorflow - */ - public GraphRunner(byte[] graphToUse,List inputNames,List outputNames) { - this(graphToUse,inputNames,outputNames,getAlignedWithNd4j()); + static { + recastGraphDefs = new ConcurrentHashMap<>(); } /** - * Initialize with the graph content to use - * @param filePath path of a protobuf file saved by tensorflow - * @param inputNames the input namesfor the graph + * The constructor for creating a graph runner via builder + * @param inputNames the input names to use + * @param outputNames the output names to use + * @param savedModelConfig the saved model configuration to load from (note this can not be used in conjunction + * with graph path) + * @param sessionOptionsConfigProto the session options for running the model (this maybe null) + * @param sessionOptionsProtoBytes the proto bytes equivalent of the session configuration + * @param sessionOptionsProtoPath the file path to a session configuration proto file + * @param graph the tensorflow graph to use + * @param graphPath the path to the graph + * @param graphBytes the in memory bytes of the graph + * @param inputDataTypes the expected input data types + * @param outputDataTypes the expected output data types */ - public GraphRunner(String filePath,List inputNames,List outputNames) { - this(filePath,inputNames,outputNames,getAlignedWithNd4j()); - } - - - - /** - * Initialize with the graph content to use - * @param filePath path of a protobuf file saved by tensorflow - * @param inputNames the names of the inputs for the graph - * @param sessionOptionsConfiguration the session options to use - * for running sessions - */ - public GraphRunner(String filePath,List inputNames,List outputNames,org.tensorflow.framework.ConfigProto sessionOptionsConfiguration) { - byte[] graphToUse = null; - + @Builder + public GraphRunner(List inputNames, + List outputNames, + SavedModelConfig savedModelConfig, + org.tensorflow.framework.ConfigProto sessionOptionsConfigProto, + byte[] sessionOptionsProtoBytes, + File sessionOptionsProtoPath, + TF_Graph graph, + File graphPath, + byte[] graphBytes, + Map inputDataTypes, + Map outputDataTypes) { try { - this.inputOrder = inputNames; - this.outputOrder = outputNames; - this.protoBufConfigProto = sessionOptionsConfiguration; - initOptionsIfNeeded(); - graphToUse = IOUtils.toByteArray(new File(filePath).toURI()); - this.graph = conversion.loadGraph(graphToUse, status); - } catch (Exception e) { - throw new IllegalArgumentException("Unable to parse protobuf",e); - } - - initSessionAndStatusIfNeeded(graphToUse); - } - - /** - * Initialize with the graph content to use - * @param graphToUse the raw byte content - * of a protobuf file saved by tensorflow - * @param sessionOptionsConfiguration the session options to use - * for running sessions - */ - public GraphRunner(byte[] graphToUse,List inputNames,List outputNames,org.tensorflow.framework.ConfigProto sessionOptionsConfiguration) { - try { - this.inputOrder = inputNames; - this.outputOrder = outputNames; - this.protoBufConfigProto = sessionOptionsConfiguration; - initOptionsIfNeeded(); - this.graph = conversion.loadGraph(graphToUse, status); - } catch (Exception e) { - throw new IllegalArgumentException("Unable to parse protobuf",e); - } - - initSessionAndStatusIfNeeded(graphToUse); - } + if(sessionOptionsConfigProto == null) { + if(sessionOptionsConfigProto != null) { + this.sessionOptionsConfigProto = ConfigProto.parseFrom(sessionOptionsProtoBytes); + } + else if(sessionOptionsProtoPath != null) { + byte[] load = FileUtils.readFileToByteArray(sessionOptionsProtoPath); + this.sessionOptionsConfigProto = ConfigProto.parseFrom(load); + } + } + else + this.sessionOptionsConfigProto = sessionOptionsConfigProto; - /** - * Initialize with the SavedModel to use - * @param inputNames (optional) the input names for the tensorflow graph - * @param outputNames the output names for the tensorflow graph - * @param savedModelConfig the configuration of the model to run - */ - public GraphRunner(List inputNames,List outputNames,SavedModelConfig savedModelConfig) { - this(inputNames,outputNames,savedModelConfig,getAlignedWithNd4j()); - } - - /** - * Initialize with the SavedModel to use - * @param inputNames (optional) the input names for the tensorflow graph - * @param outputNames (optional) the output names for the tensorflow graph - * @param savedModelConfig the configuration for the saved model - * @param sessionOptionsConfiguration the session options to use - * for running sessions - */ - public GraphRunner(List inputNames,List outputNames,SavedModelConfig savedModelConfig, ConfigProto sessionOptionsConfiguration) { - try { - this.savedModelConfig = savedModelConfig; - this.protoBufConfigProto = sessionOptionsConfiguration; + this.inputDataTypes = inputDataTypes; + this.outputDataTypes = outputDataTypes; //note that the input and output order, maybe null here //if the names are specified, we should defer to those instead this.inputOrder = inputNames; this.outputOrder = outputNames; initOptionsIfNeeded(); - Map inputsMap = new LinkedHashMap(); - Map outputsMap = new LinkedHashMap(); - this.graph = TF_NewGraph(); - this.session = conversion.loadSavedModel(savedModelConfig, options, null, graph, inputsMap, outputsMap, status); - inputOrder = new ArrayList(inputsMap.keySet()); - outputOrder = new ArrayList(outputsMap.keySet()); - savedModelConfig.setSavedModelInputOrder(new ArrayList(inputsMap.values())); - savedModelConfig.setSaveModelOutputOrder(new ArrayList(outputsMap.values())); + + if(graph != null) { + this.graph = graph; + } + else if(graphBytes != null) { + this.graph = conversion.loadGraph(graphBytes, status); + } + else if(graphPath != null) { + graphBytes = IOUtils.toByteArray(graphPath.toURI()); + this.graph = conversion.loadGraph(graphBytes, status); + } + else + this.graph = TF_NewGraph(); + + if(savedModelConfig != null) { + this.savedModelConfig = savedModelConfig; + Map inputsMap = new LinkedHashMap<>(); + Map outputsMap = new LinkedHashMap<>(); + + this.session = conversion.loadSavedModel(savedModelConfig, options, null, this.graph, inputsMap, outputsMap, status); + + if(inputOrder == null || inputOrder.isEmpty()) + inputOrder = new ArrayList<>(inputsMap.values()); + if(outputOrder == null || outputOrder.isEmpty()) + outputOrder = new ArrayList<>(outputsMap.values()); + + savedModelConfig.setSavedModelInputOrder(new ArrayList<>(inputsMap.values())); + savedModelConfig.setSaveModelOutputOrder(new ArrayList<>(outputsMap.values())); + log.info("Loaded input names from saved model configuration " + inputOrder); + log.info("Loaded output names from saved model configuration " + outputOrder); + + } + + + initSessionAndStatusIfNeeded(graphBytes); } catch (Exception e) { throw new IllegalArgumentException("Unable to parse protobuf",e); } @@ -235,135 +178,249 @@ public class GraphRunner implements Closeable { - /** - * Pass in a graph instance and - * the length of the protobuf - * that it was instantiated with. - * For files this is typically - * {@link File#length()}, - * for byte arrays, this is - * byte array.length - * and for {@link java.nio.ByteBuffer} - * this would be something like the - * {@link java.nio.ByteBuffer#capacity()} - * @param graph a pointer to the {@link TF_Graph} to use when executing - * @param graphDef {@link org.tensorflow.framework.GraphDef} protobuf - * definition containing - * the graph configuration - * for automatically inferring - * things like - * graph inputs and outputs + * Cast inputs from the original data type + * to the target resulting input data type. + * This is for when there's a disconnect from the inputs + * to the target input data type. This runs a pre cast automatically. + * @param inputs the inputs to cast + * @return the re casted input */ - public GraphRunner(List inputNames,TF_Graph graph,org.tensorflow.framework.GraphDef graphDef) { - this(inputNames,null,graph,graphDef,null); - - } - - /** - * Pass in a graph instance and - * the length of the protobuf - * that it was instantiated with. - * For files this is typically - * {@link File#length()}, - * for byte arrays, this is - * byte array.length - * and for {@link java.nio.ByteBuffer} - * this would be something like the - * {@link java.nio.ByteBuffer#capacity()} - * @param graph a pointer to the {@link TF_Graph} to use when executing - * @param graphDef {@link org.tensorflow.framework.GraphDef} protobuf - * definition containing - * the graph configuration - * for automatically inferring - * things like - * graph inputs and outputs - * @param configProto the session configuration proto to use with this runner - */ - public GraphRunner(List inputNames,TF_Graph graph,org.tensorflow.framework.GraphDef graphDef,ConfigProto configProto) { - this(inputNames,null,graph,graphDef,configProto); - - } - - /** - * Initialize with the graph content to use - * @param inputNames the inputs to the graph - * @param graphToUse the raw byte content - * of a protobuf file saved by tensorflow - */ - public GraphRunner(byte[] graphToUse,List inputNames) { - this(graphToUse,inputNames,getAlignedWithNd4j()); + public Map recastInputs(Map inputs) { + return recastInputs(inputs,inputOrder,inputDataTypes); } /** - * Initialize with the graph content to use - * @param filePath path of a protobuf file saved by tensorflow - * @param inputNames the input namesfor the graph + * Cast inputs from the original data type + * to the target resulting input data type. + * This is for when there's a disconnect from the inputs + * to the target input data type. This runs a pre cast automatically. + * @param inputs the inputs to cast + * @return the re casted input */ - public GraphRunner(String filePath,List inputNames) { - this(filePath,inputNames,getAlignedWithNd4j()); - } - - - - /** - * Initialize with the graph content to use - * @param filePath path of a protobuf file saved by tensorflow - * @param inputNames the names of the inputs for the graph - * @param sessionOptionsConfiguration the session options to use - * for running sessions - */ - public GraphRunner(String filePath,List inputNames,org.tensorflow.framework.ConfigProto sessionOptionsConfiguration) { - this(filePath,inputNames,null,sessionOptionsConfiguration); - } - - /** - * Initialize with the graph content to use - * @param graphToUse the raw byte content - * of a protobuf file saved by tensorflow - * @param sessionOptionsConfiguration the session options to use - * for running sessions - */ - public GraphRunner(byte[] graphToUse,List inputNames,org.tensorflow.framework.ConfigProto sessionOptionsConfiguration) { - this(graphToUse,inputNames,null,sessionOptionsConfiguration); + public Map recastOutputs(Map inputs) { + return recastInputs(inputs,outputOrder,outputDataTypes); } /** - * Initialize with the SavedModel to use - * @param savedModelConfig the configuration for loading the saved model + * Automatically recast the input arrays + * as the specified types + * @param inputs the input tensors to recast + * @param inputOrder the order of the input tensors + * @param inputDataTypes the data types to cast to (null means stay the same) + * @return the new values */ - public GraphRunner(SavedModelConfig savedModelConfig) { - this(savedModelConfig,getAlignedWithNd4j()); + public Map recastInputs(Map inputs, List inputOrder, Map inputDataTypes) { + if(inputDataTypes == null || inputDataTypes.isEmpty()) { + + inputDataTypes = new LinkedHashMap<>(); + for(int i = 0; i < inputOrder.size(); i++) { + TensorDataType tensorDataType = TensorDataType.values()[TF_TensorType(inputs.get(inputOrder.get(i)))]; + Preconditions.checkNotNull(tensorDataType,"Data type of " + TF_TensorType(inputs.get(inputOrder.get(i))) + " was null!"); + inputDataTypes.put(inputOrder.get(i),tensorDataType); + } + } + + Map ret = new HashMap<>(); + for(int i = 0; i < inputOrder.size(); i++) { + TF_Tensor currInput = inputs.get(inputOrder.get(i)); + TensorDataType fromDType = TensorDataType.values()[TF_TensorType(currInput)]; + if(fromDType != inputDataTypes.get(inputOrder.get(i))) { + TF_Tensor oldTensor = currInput; + currInput = castTensor(currInput, fromDType, inputDataTypes.get(inputOrder.get(i))); + TF_DeleteTensor(oldTensor); + } + + ret.put(inputOrder.get(i),currInput); + } + + return ret; } /** - * Initialize with the SavedModel to use - * @param savedModelConfig the configuration for loading the saved model - * @param sessionOptionsConfiguration the session options to use - * for running sessions + * Run the graph definition with the given inputs + * in native tensorflow + * @param inputs the inputs to run + * @return the outputSchema from the native tensorflow wrapper */ - public GraphRunner(SavedModelConfig savedModelConfig, ConfigProto sessionOptionsConfiguration) { - try { - this.savedModelConfig = savedModelConfig; - this.protoBufConfigProto = sessionOptionsConfiguration; - initOptionsIfNeeded(); - Map inputsMap = new LinkedHashMap<>(); - Map outputsMap = new LinkedHashMap<>(); - this.graph = TF_NewGraph(); - this.session = conversion.loadSavedModel(savedModelConfig, options, null, graph, inputsMap, outputsMap, status); - inputOrder = new ArrayList<>(inputsMap.keySet()); - outputOrder = new ArrayList<>(outputsMap.keySet()); - savedModelConfig.setSavedModelInputOrder(new ArrayList<>(inputsMap.values())); - savedModelConfig.setSaveModelOutputOrder(new ArrayList<>(outputsMap.values())); - } catch (Exception e) { - throw new IllegalArgumentException("Unable to parse protobuf",e); + public Map runTfTensor(Map inputs) { + if(graph == null) { + throw new IllegalStateException("Graph not initialized."); + } + + + if(inputs.size() != inputOrder.size()) { + throw new IllegalArgumentException("Number of inputs specified do not match number of arrays specified."); + } + + if(inputDataTypes == null) { + inputDataTypes = new LinkedHashMap<>(); + for(int i = 0; i < inputOrder.size(); i++) { + inputDataTypes.put(inputOrder.get(i),TensorDataType.values()[TF_TensorType(inputs.get(inputOrder.get(i)))]); + } + } + + for(Map.Entry entry : inputs.entrySet()) { + Preconditions.checkNotNull(entry.getValue(),"Entry " + entry.getKey() + " was null!"); + } + + //recast for adapting input + inputs = recastInputs(inputs); + + + if(savedModelConfig != null) { + Map outputArrays = new LinkedHashMap<>(); + + Map opsByName = new HashMap<>(); + org.bytedeco.tensorflow.TF_Output inputOut = new org.bytedeco.tensorflow.TF_Output(savedModelConfig.getSavedModelInputOrder().size()); + + TF_Tensor[] inputTensors = new TF_Tensor[savedModelConfig.getSavedModelInputOrder().size()]; + for(int i = 0; i < savedModelConfig.getSavedModelInputOrder().size(); i++) { + String[] name = savedModelConfig.getSavedModelInputOrder().get(i).split(":"); + org.bytedeco.tensorflow.TF_Operation inputOp = TF_GraphOperationByName(graph, name[0]); + opsByName.put(savedModelConfig.getSavedModelInputOrder().get(i),inputOp); + inputOut.position(i).oper(inputOp).index(name.length > 1 ? Integer.parseInt(name[1]) : 0); + TF_Tensor tfTensor = inputs.get(inputOrder != null && !inputOrder.isEmpty() + ? inputOrder.get(i) : savedModelConfig.getSavedModelInputOrder().get(i)); + inputTensors[i] = tfTensor; + } + + + //reset the position of the pointer for execution + inputOut.position(0); + + org.bytedeco.tensorflow.TF_Output outputOut = new org.bytedeco.tensorflow.TF_Output(savedModelConfig.getSaveModelOutputOrder().size()); + //only setup the output ops + for(int i = 0; i < savedModelConfig.getSaveModelOutputOrder().size(); i++) { + String[] name = savedModelConfig.getSaveModelOutputOrder().get(i).split(":"); + org.bytedeco.tensorflow.TF_Operation outputOp = TF_GraphOperationByName(graph, name[0]); + opsByName.put(savedModelConfig.getSaveModelOutputOrder().get(i),outputOp); + outputOut.position(i).oper(outputOp).index(name.length > 1 ? Integer.parseInt(name[1]) : 0); + } + + //reset the position of the pointer for execution + outputOut.position(0); + + + + //these are references to the nd4j ndarrays wrapped for tensorflow + PointerPointer inputTensorsPointer = new PointerPointer<>(inputTensors); + //note that these are the result pointers + //the result pointers are null, and will be populated automatically by the session run + PointerPointer outputTensorsPointer = new PointerPointer<>(savedModelConfig.getSaveModelOutputOrder().size()); + + long start = System.nanoTime(); + TF_SessionRun( + session, + null, + //inputs + inputOut, inputTensorsPointer, inputTensors.length, + //outputSchema + outputOut, outputTensorsPointer, savedModelConfig.getSaveModelOutputOrder().size(), + //targets + null, 0, + null, + status); long end = System.nanoTime(); + long diff = TimeUnit.NANOSECONDS.toMillis((end - start)); + log.debug("Session runtime: {} ms", diff); + + + + + if (TF_GetCode(status) != TF_OK) { + throw new IllegalStateException("ERROR: Unable to run session " + TF_Message(status).getString()); + } else { + for(int i = 0; i < outputOrder.size(); i++) { + outputArrays.put(outputOrder != null && !outputOrder.isEmpty() ? outputOrder.get(i) : + savedModelConfig.getSaveModelOutputOrder().get(i),new TF_Tensor(outputTensorsPointer.get(i))); + } + + } + + return outputArrays; + + } + else { + Map outputArrays = new LinkedHashMap<>(); + + Map opsByName = new HashMap<>(); + org.bytedeco.tensorflow.TF_Output inputOut = new org.bytedeco.tensorflow.TF_Output(inputOrder.size()); + + TF_Tensor[] inputTensors = new TF_Tensor[inputOrder.size()]; + for(int i = 0; i < inputOrder.size(); i++) { + String[] name = inputOrder.get(i).split(":"); + org.bytedeco.tensorflow.TF_Operation inputOp = TF_GraphOperationByName(graph, name[0]); + opsByName.put(inputOrder.get(i),inputOp); + inputOut.position(i).oper(inputOp).index(name.length > 1 ? Integer.parseInt(name[1]) : 0); + TF_Tensor tf_tensor = inputs.get(inputOrder.get(i)); + + inputTensors[i] = tf_tensor; + } + + + //reset the position of the pointer for execution + inputOut.position(0); + + org.bytedeco.tensorflow.TF_Output outputOut = new org.bytedeco.tensorflow.TF_Output(outputOrder.size()); + //only setup the output ops + for(int i = 0; i < outputOrder.size(); i++) { + String[] name = outputOrder.get(i).split(":"); + org.bytedeco.tensorflow.TF_Operation outputOp = TF_GraphOperationByName(graph, name[0]); + if(outputOp == null) { + throw new IllegalArgumentException("Illegal output found " + outputOrder.get(i) + " - no op found! Mis specified name perhaps?"); + } + + opsByName.put(outputOrder.get(i),outputOp); + outputOut.position(i).oper(outputOp).index(name.length > 1 ? Integer.parseInt(name[1]) : 0); + } + + //reset the position of the pointer for execution + outputOut.position(0); + + + + //these are references to the nd4j ndarrays wrapped for tensorflow + PointerPointer inputTensorsPointer = new PointerPointer<>(inputTensors); + //note that these are the result pointers + //the result pointers are null, and will be populated automatically by the session run + PointerPointer outputTensorsPointer = new PointerPointer<>(outputOrder.size()); + + long start = System.nanoTime(); + TF_SessionRun( + session, + null, + //inputs + inputOut, inputTensorsPointer, inputOrder.size(), + //output + outputOut, outputTensorsPointer, outputOrder.size(), + //targets + null, 0, + null, + status); + long end = System.nanoTime(); + long diff = TimeUnit.NANOSECONDS.toMillis((end - start)); + log.debug("Session runtime: {} ms", diff); + + + + + + + if (TF_GetCode(status) != TF_OK) { + throw new IllegalStateException("ERROR: Unable to run session " + TF_Message(status).getString()); + } else { + for(int i = 0; i < outputOrder.size(); i++) { + outputArrays.put(outputOrder.get(i),new TF_Tensor(outputTensorsPointer.get(i))); + } + } + + return outputArrays; } } - /** * Returns a map of the output names * to the ndarrays matching each output. @@ -382,159 +439,25 @@ public class GraphRunner implements Closeable { * {@link INDArray} * @return a map of the output names to the * ndarrays matching each output specified in the graph - * @throws IOException */ public Map run(Map inputs) { - if(graph == null) { - throw new IllegalStateException("Graph not initialized."); + if (!isTfWarmedUp && !isTfWarmingUp){ + isTfWarmingUp = true; + run(inputs); + isTfWarmedUp = true; + } + Map inputTensors = new LinkedHashMap<>(); + for(Map.Entry input : inputs.entrySet()) { + inputTensors.put(input.getKey(),conversion.tensorFromNDArray(input.getValue())); } - if(inputs.size() != inputOrder.size()) { - throw new IllegalArgumentException("Number of inputs specified do not match number of arrays specified."); - } - - - if(savedModelConfig != null) { - Map outputArrays = new LinkedHashMap<>(); - - Map opsByName = new HashMap<>(); - TF_Output inputOut = new TF_Output(savedModelConfig.getSavedModelInputOrder().size()); - - TF_Tensor[] inputTensors = new TF_Tensor[savedModelConfig.getSavedModelInputOrder().size()]; - for(int i = 0; i < savedModelConfig.getSavedModelInputOrder().size(); i++) { - String[] name = savedModelConfig.getSavedModelInputOrder().get(i).split(":"); - TF_Operation inputOp = TF_GraphOperationByName(graph, name[0]); - opsByName.put(savedModelConfig.getSavedModelInputOrder().get(i),inputOp); - inputOut.position(i).oper(inputOp).index(name.length > 1 ? Integer.parseInt(name[1]) : 0); - TF_Tensor tf_tensor = conversion.tensorFromNDArray(inputs.get(inputOrder != null && !inputOrder.isEmpty() - ? inputOrder.get(i) : savedModelConfig.getSavedModelInputOrder().get(i))); - inputTensors[i] = tf_tensor; - } - - - //reset the position of the pointer for execution - inputOut.position(0); - - TF_Output outputOut = new TF_Output(savedModelConfig.getSaveModelOutputOrder().size()); - //only setup the output ops - for(int i = 0; i < savedModelConfig.getSaveModelOutputOrder().size(); i++) { - String[] name =savedModelConfig.getSaveModelOutputOrder().get(i).split(":"); - TF_Operation outputOp = TF_GraphOperationByName(graph, name[0]); - opsByName.put(savedModelConfig.getSaveModelOutputOrder().get(i),outputOp); - outputOut.position(i).oper(outputOp).index(name.length > 1 ? Integer.parseInt(name[1]) : 0); - } - - //reset the position of the pointer for execution - outputOut.position(0); - - - - //these are references to the nd4j ndarrays wrapped for tensorflow - PointerPointer inputTensorsPointer = new PointerPointer<>(inputTensors); - //note that these are the result pointers - //the result pointers are null, and will be populated automatically by the session run - PointerPointer outputTensorsPointer = new PointerPointer<>(savedModelConfig.getSaveModelOutputOrder().size()); - - - TF_SessionRun( - session, - null, - //inputs - inputOut, inputTensorsPointer, inputTensors.length, - //outputs - outputOut, outputTensorsPointer, savedModelConfig.getSaveModelOutputOrder().size(), - //targets - null, 0, - null, - status); - - - if (TF_GetCode(status) != TF_OK) { - throw new IllegalStateException("ERROR: Unable to run session " + TF_Message(status).getString()); - } else { - for(int i = 0; i < outputOrder.size(); i++) { - INDArray to = conversion.ndArrayFromTensor(new TF_Tensor(outputTensorsPointer.get(i))); - outputArrays.put(outputOrder != null && !outputOrder.isEmpty() ? outputOrder.get(i) : - savedModelConfig.getSaveModelOutputOrder().get(i),to); - } - - } - - return outputArrays; - - } - else { - Map outputArrays = new LinkedHashMap<>(); - - Map opsByName = new HashMap<>(); - TF_Output inputOut = new TF_Output(inputOrder.size()); - - TF_Tensor[] inputTensors = new TF_Tensor[inputOrder.size()]; - for(int i = 0; i < inputOrder.size(); i++) { - String[] name = inputOrder.get(i).split(":"); - TF_Operation inputOp = TF_GraphOperationByName(graph, name[0]); - opsByName.put(inputOrder.get(i),inputOp); - inputOut.position(i).oper(inputOp).index(name.length > 1 ? Integer.parseInt(name[1]) : 0); - TF_Tensor tf_tensor = conversion.tensorFromNDArray(inputs.get(inputOrder.get(i))); - inputTensors[i] = tf_tensor; - } - - - //reset the position of the pointer for execution - inputOut.position(0); - - TF_Output outputOut = new TF_Output(outputOrder.size()); - //only setup the output ops - for(int i = 0; i < outputOrder.size(); i++) { - String[] name = outputOrder.get(i).split(":"); - TF_Operation outputOp = TF_GraphOperationByName(graph, name[0]); - if(outputOp == null) { - throw new IllegalArgumentException("Illegal input found " + inputOrder.get(i) + " - no op found! Mis specified name perhaps?"); - } - - opsByName.put(outputOrder.get(i),outputOp); - outputOut.position(i).oper(outputOp).index(name.length > 1 ? Integer.parseInt(name[1]) : 0); - } - - //reset the position of the pointer for execution - outputOut.position(0); - - - - //these are references to the nd4j ndarrays wrapped for tensorflow - PointerPointer inputTensorsPointer = new PointerPointer<>(inputTensors); - //note that these are the result pointers - //the result pointers are null, and will be populated automatically by the session run - PointerPointer outputTensorsPointer = new PointerPointer<>(outputOrder.size()); - - - TF_SessionRun( - session, - null, - //inputs - inputOut, inputTensorsPointer, inputTensors.length, - //outputs - outputOut, outputTensorsPointer, outputOrder.size(), - //targets - null, 0, - null, - status); - - - if (TF_GetCode(status) != TF_OK) { - throw new IllegalStateException("ERROR: Unable to run session " + TF_Message(status).getString()); - } else { - for(int i = 0; i < outputOrder.size(); i++) { - INDArray to = conversion.ndArrayFromTensor(new TF_Tensor(outputTensorsPointer.get(i))); - outputArrays.put(outputOrder.get(i),to); - } - - } - - return outputArrays; - + Map outputTensors = runTfTensor(inputTensors); + Map output = new LinkedHashMap<>(); + for(Map.Entry outputTensor : outputTensors.entrySet()) { + output.put(outputTensor.getKey(),conversion.ndArrayFromTensor(outputTensor.getValue())); } + return output; } @@ -546,8 +469,8 @@ public class GraphRunner implements Closeable { if (options == null) { options = TF_NewSessionOptions(); - if(protoBufConfigProto != null) { - BytePointer bytePointer = new BytePointer(protoBufConfigProto.toByteArray()); + if(sessionOptionsConfigProto != null) { + BytePointer bytePointer = new BytePointer(sessionOptionsConfigProto.toByteArray()); TF_SetConfig(options,bytePointer,bytePointer.getStringBytes().length,status); if (TF_GetCode(status) != TF_OK) { throw new IllegalStateException("ERROR: Unable to set value configuration:" + TF_Message(status).getString()); @@ -557,7 +480,7 @@ public class GraphRunner implements Closeable { } private void initSessionAndStatusIfNeeded(org.tensorflow.framework.GraphDef graphDef1) { - //infer the inputs and outputs for the graph + //infer the inputs and outputSchema for the graph Set seenAsInput = new LinkedHashSet<>(); for(int i = 0; i < graphDef1.getNodeCount(); i++) { NodeDef node = graphDef1.getNode(i); @@ -569,7 +492,7 @@ public class GraphRunner implements Closeable { if(outputOrder == null) { outputOrder = new ArrayList<>(); log.trace("Attempting to automatically resolve tensorflow output names.."); - //find the nodes that were not inputs to any nodes: these are the outputs + //find the nodes that were not inputs to any nodes: these are the outputSchema for(int i = 0; i < graphDef1.getNodeCount(); i++) { if(!seenAsInput.contains(graphDef1.getNode(i).getName()) && !graphDef1.getNode(i).getOp().equals("Placeholder")) { outputOrder.add(graphDef1.getNode(i).getName()); @@ -604,37 +527,20 @@ public class GraphRunner implements Closeable { } private void initSessionAndStatusIfNeeded(byte[] graphToUse) { + if(graphToUse == null) { + //saved model configuration + return; + } + try { //use the protobuf api to load the graph definition and load the node metadata org.tensorflow.framework.GraphDef graphDef1 = org.tensorflow.framework.GraphDef.parseFrom(graphToUse); initSessionAndStatusIfNeeded(graphDef1); - } catch (InvalidProtocolBufferException e) { + } catch (org.nd4j.shade.protobuf.InvalidProtocolBufferException e) { e.printStackTrace(); } } - public static org.tensorflow.framework.ConfigProto getAlignedWithNd4j() { - org.tensorflow.framework.ConfigProto configProto = org.tensorflow.framework.ConfigProto.getDefaultInstance(); - ConfigProto.Builder builder1 = configProto.toBuilder().addDeviceFilters(TensorflowConversion.defaultDeviceForThread()); - try { - //cuda - if(Nd4j.getBackend().getClass().getName().toLowerCase().contains("jcu")) { - builder1.setGpuOptions(GPUOptions.newBuilder() - .setAllowGrowth(true) - .setPerProcessGpuMemoryFraction(0.5) - .build()); - } - //cpu - else { - } - - } catch (Exception e) { - e.printStackTrace(); - } - - return builder1.build(); - } - /** * Convert a json string written out @@ -646,9 +552,9 @@ public class GraphRunner implements Closeable { public static org.tensorflow.framework.ConfigProto fromJson(String json) { org.tensorflow.framework.ConfigProto.Builder builder = org.tensorflow.framework.ConfigProto.newBuilder(); try { - JsonFormat.parser().merge(json,builder); + org.nd4j.shade.protobuf.util.JsonFormat.parser().merge(json,builder); org.tensorflow.framework.ConfigProto build = builder.build(); - ByteString serialized = build.toByteString(); + org.nd4j.shade.protobuf.ByteString serialized = build.toByteString(); byte[] binaryString = serialized.toByteArray(); org.tensorflow.framework.ConfigProto configProto = org.tensorflow.framework.ConfigProto.parseFrom(binaryString); return configProto; @@ -661,15 +567,76 @@ public class GraphRunner implements Closeable { /** - * Write out the session options used - * by this {@link GraphRunner} - * a s a json string using the - * {@link JsonFormat} - * @return + * Cast a tensor to another type using + * the tensorflow c api. + * This method loads a graph from the classpath from + * cast_graph/cast_(name of datatype lower case).pb + * which contains a simple protobuf file with a + * variant data type tensorflow input place holder + * named place holder and an output named cast_output. + * @param input the input data + * @param from the input data type to cast from + * @param to the output data type to + * @return the casted tensor */ - public String sessionOptionsToJson() { + public static TF_Tensor castTensor(TF_Tensor input, TensorDataType from, TensorDataType to) { + if(from.equals(to)) + return input; + + Map inputMap = new HashMap<>(); + inputMap.put("input",input); + GraphRunner graphRunner = getRunner(from,to); try { - return JsonFormat.printer().print(protoBufConfigProto); + Map output = graphRunner.runTfTensor(inputMap); + return output.get("cast_output"); + + } catch(Exception e) { + throw new IllegalStateException("Unable to run graph",e); + } + } + + private static GraphRunner getRunner(TensorDataType from,TensorDataType to) { + Pair key = Pair.of(from,to); + if(!recastGraphDefs.containsKey(key)) { + byte[] graphForDataType = graphForDataType(from,to); + GraphRunner graphRunner = GraphRunner.builder() + .graphBytes(graphForDataType) + .inputNames(Arrays.asList("input")) + .outputNames(Arrays.asList("cast_output")) + .build(); + + recastGraphDefs.put(key,graphRunner); + return graphRunner; + } + + return recastGraphDefs.get(key); + } + + + private static byte[] graphForDataType(TensorDataType from,TensorDataType to) { + ClassPathResource classPathResource = new ClassPathResource("cast_graph/cast_" + TensorDataType.toPythonName(from) + "_" + TensorDataType.toPythonName(to) + ".pb"); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + try (InputStream is = classPathResource.getInputStream()) { + IOUtils.copy(is, byteArrayOutputStream); + } catch (IOException e) { + throw new IllegalStateException("Unable to read graph " + classPathResource.getFilename(),e); + } + + return byteArrayOutputStream.toByteArray(); + } + + /** + * Write out the session options used + * by this {@link org.nd4j.tensorflow.conversion.graphrunner.GraphRunner} + * a s a json string using the + * {@link org.nd4j.shade.protobuf.util.JsonFormat} + * @return the session options as json (mainly for debugging) + */ + public String sessionOptionsToJson() { + if(sessionOptionsConfigProto == null) + return null; + try { + return org.nd4j.shade.protobuf.util.JsonFormat.printer().print(sessionOptionsConfigProto); } catch (Exception e) { e.printStackTrace(); } @@ -695,4 +662,25 @@ public class GraphRunner implements Closeable { TF_DeleteStatus(status); } } + public static org.tensorflow.framework.ConfigProto getAlignedWithNd4j() { + org.tensorflow.framework.ConfigProto configProto = org.tensorflow.framework.ConfigProto.getDefaultInstance(); + ConfigProto.Builder builder1 = configProto.toBuilder().addDeviceFilters(TensorflowConversion.defaultDeviceForThread()); + try { + //cuda + if(Nd4j.getBackend().getClass().getName().toLowerCase().contains("jcu")) { + builder1.setGpuOptions(org.tensorflow.framework.GPUOptions.newBuilder() + .setAllowGrowth(true) + .setPerProcessGpuMemoryFraction(0.5) + .build()); + } + //cpu + else { + } + + } catch (Exception e) { + e.printStackTrace(); + } + + return builder1.build(); + } } diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/ai/__init__.py b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/ai/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/ai/konduit/__init__.py b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/ai/konduit/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/ai/konduit/casting.py b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/ai/konduit/casting.py new file mode 100644 index 000000000..b6123f557 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/ai/konduit/casting.py @@ -0,0 +1,17 @@ +import tensorflow as tf + +dtypes = [tf.float16,tf.float32,tf.float64,tf.int8,tf.int16,tf.int32,tf.int64,tf.uint8,tf.uint16,tf.uint32,tf.uint64] +# Quick solution from https://stackoverflow.com/questions/5360220/how-to-split-a-list-into-pairs-in-all-possible-ways :) +import itertools +def all_pairs(lst): + return [(x,y) for x in dtypes for y in dtypes] + + +for item in all_pairs(dtypes): + from_dtype, out_dtype = item + tf.reset_default_graph() + input = tf.placeholder(name='input',dtype=from_dtype) + result = tf.cast(input,name='cast_output',dtype=out_dtype) + + with tf.Session() as session: + tf.train.write_graph(tf.get_default_graph(),logdir='.',name='cast_' + from_dtype.name + '_' + out_dtype.name + '.pb',as_text=True) \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float16.pb new file mode 100644 index 000000000..6ed3318d5 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float16.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +shape:* +dtype0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float32.pb new file mode 100644 index 000000000..909d8f5ab --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float64.pb new file mode 100644 index 000000000..0b51cb893 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_float64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int16.pb new file mode 100644 index 000000000..ac8d85756 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int32.pb new file mode 100644 index 000000000..4f057d6ef --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int64.pb new file mode 100644 index 000000000..92e8fc124 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int8.pb new file mode 100644 index 000000000..4317504d5 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_int8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint16.pb new file mode 100644 index 000000000..8f2f205ce --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint32.pb new file mode 100644 index 000000000..0825b92ad --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint64.pb new file mode 100644 index 000000000..2a3284c7b --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint8.pb new file mode 100644 index 000000000..f06af1592 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float16_uint8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float16.pb new file mode 100644 index 000000000..4a947478d --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float32.pb new file mode 100644 index 000000000..843c041e3 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float32.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +shape:* +dtype0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float64.pb new file mode 100644 index 000000000..d65a4b1c5 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_float64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int16.pb new file mode 100644 index 000000000..32336df2e --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int32.pb new file mode 100644 index 000000000..e94d38894 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int64.pb new file mode 100644 index 000000000..721274c2a --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int8.pb new file mode 100644 index 000000000..00463da39 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_int8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint16.pb new file mode 100644 index 000000000..5428c9239 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint32.pb new file mode 100644 index 000000000..45a199fd7 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint64.pb new file mode 100644 index 000000000..4c6fd3bee --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint8.pb new file mode 100644 index 000000000..653f37625 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float32_uint8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float16.pb new file mode 100644 index 000000000..7ab02b8c7 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float32.pb new file mode 100644 index 000000000..3678a0f7e --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float64.pb new file mode 100644 index 000000000..96551b5f2 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_float64.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +dtype0* +shape:" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int16.pb new file mode 100644 index 000000000..2290faa8e --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int32.pb new file mode 100644 index 000000000..5f4880ac4 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int64.pb new file mode 100644 index 000000000..d1e43b903 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0 * + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int8.pb new file mode 100644 index 000000000..c5e83bcbf --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_int8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint16.pb new file mode 100644 index 000000000..41eafba45 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint32.pb new file mode 100644 index 000000000..315b6819f --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint64.pb new file mode 100644 index 000000000..ebb92ce54 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint8.pb new file mode 100644 index 000000000..a71d3c7d2 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_float64_uint8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float16.pb new file mode 100644 index 000000000..3ab637e88 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float32.pb new file mode 100644 index 000000000..b26891dd6 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float64.pb new file mode 100644 index 000000000..5be28d608 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_float64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int16.pb new file mode 100644 index 000000000..73a7c2f45 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int16.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +shape:* +dtype0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int32.pb new file mode 100644 index 000000000..c05482d34 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int64.pb new file mode 100644 index 000000000..5cab21d36 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int8.pb new file mode 100644 index 000000000..d57e7a282 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_int8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint16.pb new file mode 100644 index 000000000..b1d496198 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint32.pb new file mode 100644 index 000000000..84a42abf3 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint64.pb new file mode 100644 index 000000000..6e5fe3e73 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint8.pb new file mode 100644 index 000000000..d48963b0b --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int16_uint8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float16.pb new file mode 100644 index 000000000..a7dc7de1e --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float32.pb new file mode 100644 index 000000000..9ced9a4ff --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float64.pb new file mode 100644 index 000000000..f259ee12b --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_float64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int16.pb new file mode 100644 index 000000000..0b043570d --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int32.pb new file mode 100644 index 000000000..037f42cc4 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int32.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +dtype0* +shape:" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int64.pb new file mode 100644 index 000000000..84ef4a332 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0 * + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int8.pb new file mode 100644 index 000000000..077790125 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_int8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint16.pb new file mode 100644 index 000000000..69c8ddb2a --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint32.pb new file mode 100644 index 000000000..678bc53d1 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint64.pb new file mode 100644 index 000000000..a191518a4 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint8.pb new file mode 100644 index 000000000..04ab7ddea --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int32_uint8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float16.pb new file mode 100644 index 000000000..52ebc3381 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0 * +shape: +2 + cast_outputCastinput* + +SrcT0 * + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float32.pb new file mode 100644 index 000000000..3592143ad --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0 * +shape: +2 + cast_outputCastinput* + +SrcT0 * + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float64.pb new file mode 100644 index 000000000..45eea92e4 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_float64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0 * +shape: +2 + cast_outputCastinput* + +SrcT0 * + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int16.pb new file mode 100644 index 000000000..feca9571c --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0 * +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int32.pb new file mode 100644 index 000000000..c0eab4271 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0 * +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int64.pb new file mode 100644 index 000000000..41c2603de --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int64.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +dtype0 * +shape:" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int8.pb new file mode 100644 index 000000000..9686dd438 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_int8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +DstT0* + +SrcT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint16.pb new file mode 100644 index 000000000..680044623 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0 * +shape: +2 + cast_outputCastinput* + +SrcT0 * + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint32.pb new file mode 100644 index 000000000..6a1050a8b --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0 * +shape: +2 + cast_outputCastinput* + +SrcT0 * + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint64.pb new file mode 100644 index 000000000..c7bb130bd --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +DstT0* + +SrcT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint8.pb new file mode 100644 index 000000000..357d19961 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int64_uint8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0 * +shape: +2 + cast_outputCastinput* + +SrcT0 * + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float16.pb new file mode 100644 index 000000000..ae196efc0 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float32.pb new file mode 100644 index 000000000..929af8a70 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float64.pb new file mode 100644 index 000000000..854c2e86d --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_float64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int16.pb new file mode 100644 index 000000000..55f02ec5e --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int32.pb new file mode 100644 index 000000000..493975022 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int64.pb new file mode 100644 index 000000000..5ea30a1fa --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +DstT0 * + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int8.pb new file mode 100644 index 000000000..51066cd62 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_int8.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +dtype0* +shape:" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint16.pb new file mode 100644 index 000000000..852003d52 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint32.pb new file mode 100644 index 000000000..6e780ddb2 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint64.pb new file mode 100644 index 000000000..418e3b343 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint8.pb new file mode 100644 index 000000000..6cfc8e089 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_int8_uint8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float16.pb new file mode 100644 index 000000000..282240199 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float32.pb new file mode 100644 index 000000000..25eb2ab9a --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float64.pb new file mode 100644 index 000000000..d1584196c --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_float64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int16.pb new file mode 100644 index 000000000..45abf4e2e --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int32.pb new file mode 100644 index 000000000..91fa9f5f4 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int64.pb new file mode 100644 index 000000000..b19986b1d --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int8.pb new file mode 100644 index 000000000..4969614ea --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_int8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint16.pb new file mode 100644 index 000000000..4aca5d466 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint16.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +dtype0* +shape:" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint32.pb new file mode 100644 index 000000000..93ea93d29 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint64.pb new file mode 100644 index 000000000..2fd236f80 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint8.pb new file mode 100644 index 000000000..8240aa59b --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint16_uint8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float16.pb new file mode 100644 index 000000000..399176df5 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float32.pb new file mode 100644 index 000000000..f90591992 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float64.pb new file mode 100644 index 000000000..75a9380be --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_float64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int16.pb new file mode 100644 index 000000000..078eaa6f9 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int32.pb new file mode 100644 index 000000000..5af0c0e6b --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int64.pb new file mode 100644 index 000000000..4b4bef3ca --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int8.pb new file mode 100644 index 000000000..5d54b13fc --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_int8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint16.pb new file mode 100644 index 000000000..fcb5ab1c6 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint32.pb new file mode 100644 index 000000000..7a86995dc --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint32.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +dtype0* +shape:" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint64.pb new file mode 100644 index 000000000..0a3c6523b --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint8.pb new file mode 100644 index 000000000..28bd5a1f0 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint32_uint8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float16.pb new file mode 100644 index 000000000..ed5e22cb0 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float32.pb new file mode 100644 index 000000000..56f4196a1 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float64.pb new file mode 100644 index 000000000..7c0d0b041 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_float64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int16.pb new file mode 100644 index 000000000..f7c53be64 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int32.pb new file mode 100644 index 000000000..15e54997c --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int64.pb new file mode 100644 index 000000000..04c27b13c --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int8.pb new file mode 100644 index 000000000..0a86c1697 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_int8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint16.pb new file mode 100644 index 000000000..af4813ccb --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint32.pb new file mode 100644 index 000000000..109b8111a --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint64.pb new file mode 100644 index 000000000..9f3abb274 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint64.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +dtype0* +shape:" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint8.pb new file mode 100644 index 000000000..a56a8f083 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint64_uint8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float16.pb new file mode 100644 index 000000000..527465366 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float32.pb new file mode 100644 index 000000000..51a70a747 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float64.pb new file mode 100644 index 000000000..772605463 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_float64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int16.pb new file mode 100644 index 000000000..7d7769cb5 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int32.pb new file mode 100644 index 000000000..bd6517ea2 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int64.pb new file mode 100644 index 000000000..ec8347c31 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0 " \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int8.pb new file mode 100644 index 000000000..ef71143ef --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_int8.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint16.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint16.pb new file mode 100644 index 000000000..085586a15 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint16.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +dtype0* +shape: +2 + cast_outputCastinput* + +SrcT0* + +DstT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint32.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint32.pb new file mode 100644 index 000000000..292548245 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint32.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint64.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint64.pb new file mode 100644 index 000000000..403c58c38 --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint64.pb @@ -0,0 +1,11 @@ + +0 +input Placeholder* +shape:* +dtype0 +2 + cast_outputCastinput* + +DstT0* + +SrcT0" \ No newline at end of file diff --git a/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint8.pb b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint8.pb new file mode 100644 index 000000000..b196f006b --- /dev/null +++ b/nd4j/nd4j-tensorflow/src/main/resources/cast_graph/cast_uint8_uint8.pb @@ -0,0 +1,5 @@ + +0 +input Placeholder* +dtype0* +shape:" \ No newline at end of file