You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ph...@apache.org on 2019/06/13 01:37:05 UTC

[nifi-minifi-cpp] 03/03: MINIFICPP-918 Update TensorFlow processors to use property builder

This is an automated email from the ASF dual-hosted git repository.

phrocker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit dedeeffc3f78fe794b52d2870acf7ba69f3c2a30
Author: Andrew I. Christianson <an...@andyic.org>
AuthorDate: Wed Jun 12 16:13:09 2019 -0400

    MINIFICPP-918 Update TensorFlow processors to use property builder
    
    This closes #592.
    
    Signed-off-by: Marc Parisi <ph...@apache.org>
---
 .gitignore                                       |   1 +
 extensions/tensorflow/TFApplyGraph.cpp           |  24 ++++--
 extensions/tensorflow/TFConvertImageToTensor.cpp | 100 +++++++++++++++--------
 3 files changed, 85 insertions(+), 40 deletions(-)

diff --git a/.gitignore b/.gitignore
index b135a55..d014fd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,6 +56,7 @@ libminifi/test/**/*.a
 libminifi/include/agent/agent_version.h
 docs/generated
 thirdparty/apache-rat/apache-rat*
+/compile_commands.json
 
 # Ignore source files that have been placed in the docker directory during build
 docker/minificppsource
diff --git a/extensions/tensorflow/TFApplyGraph.cpp b/extensions/tensorflow/TFApplyGraph.cpp
index ce16d97..8d0092d 100644
--- a/extensions/tensorflow/TFApplyGraph.cpp
+++ b/extensions/tensorflow/TFApplyGraph.cpp
@@ -16,8 +16,9 @@
  */
 
 #include "TFApplyGraph.h"
-
-#include "tensorflow/cc/ops/standard_ops.h"
+#include <core/ProcessContext.h>
+#include <core/ProcessSession.h>
+#include <tensorflow/cc/ops/standard_ops.h>
 
 namespace org {
 namespace apache {
@@ -25,12 +26,19 @@ namespace nifi {
 namespace minifi {
 namespace processors {
 
-core::Property TFApplyGraph::InputNode(  // NOLINT
-    "Input Node",
-    "The node of the TensorFlow graph to feed tensor inputs to", "");
-core::Property TFApplyGraph::OutputNode(  // NOLINT
-    "Output Node",
-    "The node of the TensorFlow graph to read tensor outputs from", "");
+core::Property TFApplyGraph::InputNode(
+    core::PropertyBuilder::createProperty("Input Node")
+        ->withDescription(
+            "The node of the TensorFlow graph to feed tensor inputs to")
+        ->withDefaultValue("")
+        ->build());
+
+core::Property TFApplyGraph::OutputNode(
+    core::PropertyBuilder::createProperty("Output Node")
+        ->withDescription(
+            "The node of the TensorFlow graph to read tensor outputs from")
+        ->withDefaultValue("")
+        ->build());
 
 core::Relationship TFApplyGraph::Success(  // NOLINT
     "success",
diff --git a/extensions/tensorflow/TFConvertImageToTensor.cpp b/extensions/tensorflow/TFConvertImageToTensor.cpp
index b6a1183..5b2ace0 100644
--- a/extensions/tensorflow/TFConvertImageToTensor.cpp
+++ b/extensions/tensorflow/TFConvertImageToTensor.cpp
@@ -16,8 +16,9 @@
  */
 
 #include "TFConvertImageToTensor.h"
-
-#include "tensorflow/cc/ops/standard_ops.h"
+#include <core/ProcessContext.h>
+#include <core/ProcessSession.h>
+#include <tensorflow/cc/ops/standard_ops.h>
 
 namespace org {
 namespace apache {
@@ -25,36 +26,71 @@ namespace nifi {
 namespace minifi {
 namespace processors {
 
-core::Property TFConvertImageToTensor::ImageFormat(  // NOLINT
-    "Input Format",
-    "The format of the input image (PNG or RAW). RAW is RGB24.", "");
-core::Property TFConvertImageToTensor::InputWidth(  // NOLINT
-    "Input Width",
-    "The width, in pixels, of the input image.", "");
-core::Property TFConvertImageToTensor::InputHeight(  // NOLINT
-    "Input Height",
-    "The height, in pixels, of the input image.", "");
-core::Property TFConvertImageToTensor::OutputWidth(  // NOLINT
-    "Output Width",
-    "The width, in pixels, of the output image.", "");
-core::Property TFConvertImageToTensor::OutputHeight(  // NOLINT
-    "Output Height",
-    "The height, in pixels, of the output image.", "");
-core::Property TFConvertImageToTensor::NumChannels(  // NOLINT
-    "Channels",
-    "The number of channels (e.g. 3 for RGB, 4 for RGBA) in the input image", "3");
-core::Property TFConvertImageToTensor::CropOffsetX(  // NOLINT
-    "Crop Offset X",
-    "The X (horizontal) offset, in pixels, to crop the input image (relative to top-left corner).", "");
-core::Property TFConvertImageToTensor::CropOffsetY(  // NOLINT
-    "Crop Offset Y",
-    "The Y (vertical) offset, in pixels, to crop the input image (relative to top-left corner).", "");
-core::Property TFConvertImageToTensor::CropSizeX(  // NOLINT
-    "Crop Size X",
-    "The X (horizontal) size, in pixels, to crop the input image.", "");
-core::Property TFConvertImageToTensor::CropSizeY(  // NOLINT
-    "Crop Size Y",
-    "The Y (vertical) size, in pixels, to crop the input image.", "");
+core::Property TFConvertImageToTensor::ImageFormat(
+    core::PropertyBuilder::createProperty("Input Format")
+        ->withDescription(
+            "The format of the input image (PNG or RAW). RAW is RGB24.")
+        ->withDefaultValue("")
+        ->build());
+
+core::Property TFConvertImageToTensor::InputWidth(
+    core::PropertyBuilder::createProperty("Input Width")
+        ->withDescription("The width, in pixels, of the input image.")
+        ->withDefaultValue("")
+        ->build());
+
+core::Property TFConvertImageToTensor::InputHeight(
+    core::PropertyBuilder::createProperty("Input Height")
+        ->withDescription("The height, in pixels, of the input image.")
+        ->withDefaultValue("")
+        ->build());
+
+core::Property TFConvertImageToTensor::OutputWidth(
+    core::PropertyBuilder::createProperty("Output Width")
+        ->withDescription("The width, in pixels, of the output image.")
+        ->withDefaultValue("")
+        ->build());
+
+core::Property TFConvertImageToTensor::OutputHeight(
+    core::PropertyBuilder::createProperty("Output Height")
+        ->withDescription("The height, in pixels, of the output image.")
+        ->withDefaultValue("")
+        ->build());
+
+core::Property TFConvertImageToTensor::NumChannels(
+    core::PropertyBuilder::createProperty("Channels")
+        ->withDescription("The number of channels (e.g. 3 for RGB, 4 for RGBA) "
+                          "in the input image")
+        ->withDefaultValue("3")
+        ->build());
+
+core::Property TFConvertImageToTensor::CropOffsetX(
+    core::PropertyBuilder::createProperty("Crop Offset X")
+        ->withDescription("The X (horizontal) offset, in pixels, to crop the "
+                          "input image (relative to top-left corner).")
+        ->withDefaultValue("")
+        ->build());
+
+core::Property TFConvertImageToTensor::CropOffsetY(
+    core::PropertyBuilder::createProperty("Crop Offset Y")
+        ->withDescription("The Y (vertical) offset, in pixels, to crop the "
+                          "input image (relative to top-left corner).")
+        ->withDefaultValue("")
+        ->build());
+
+core::Property TFConvertImageToTensor::CropSizeX(
+    core::PropertyBuilder::createProperty("Crop Size X")
+        ->withDescription(
+            "The X (horizontal) size, in pixels, to crop the input image.")
+        ->withDefaultValue("")
+        ->build());
+
+core::Property TFConvertImageToTensor::CropSizeY(
+    core::PropertyBuilder::createProperty("Crop Size Y")
+        ->withDescription(
+            "The Y (vertical) size, in pixels, to crop the input image.")
+        ->withDefaultValue("")
+        ->build());
 
 core::Relationship TFConvertImageToTensor::Success(  // NOLINT
     "success",