[nnc] Problem in the ACL backend system tests fixed (#2682)
authorТимур Отеллович Аблязимов/AI Tools Lab /SRR/Staff Engineer/삼성전자 <t.ablyazimov@samsung.com>
Fri, 14 Dec 2018 19:14:20 +0000 (22:14 +0300)
committerEfimov Alexander/AI Tools Lab/./Samsung Electronics <a.efimov@samsung.com>
Fri, 14 Dec 2018 19:14:20 +0000 (22:14 +0300)
Fixed a bug in the tensor_gen. nni was renamed to nnkit-run so we had to change this in the CMakeLists.txt of the ACL backend system tests. Also the dependencies of tensor_gen, caffegen and nnkit-run were done obligatory.

Signed-off-by: Timur Ablyazimov <t.ablyazimov@samsung.com>
contrib/nnc/tests/acl_soft_backend/CMakeLists.txt
contrib/nnc/utils/input_gen/tensor_gen.cpp

index da31ad5..83eec1a 100644 (file)
@@ -2,16 +2,6 @@ function(acl_warn MESSAGE)
   message(WARNING "The ACL backend system tests will not be built: ${MESSAGE}")
 endfunction(acl_warn)
 
-if(NOT TARGET caffegen)
-  acl_warn("the CAFFEGEN was not built.")
-  return()
-endif(NOT TARGET caffegen)
-
-if(NOT TARGET nni)
-  acl_warn("the NNKIT was not built.")
-  return()
-endif(NOT TARGET nni)
-
 # Path to the folder where the Odroid root folder is either mounted or copied.
 if(NOT DEFINED ENV{ODROID_MIRROR_DIR})
   acl_warn("the ODROID_MIRROR_DIR environment variable was not defined.\n\
@@ -45,6 +35,7 @@ find_package(HDF5 COMPONENTS CXX REQUIRED)
 configure_file(BuildInfo.h.in BuildInfo.h)
 
 add_nncc_test(nnc_acl_soft_backend_system_test AclCppOperations.cpp)
+add_dependencies(nnc_acl_soft_backend_system_test tensor_gen caffegen nnkit-run)
 target_include_directories(nnc_acl_soft_backend_system_test PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
     ${HDF5_INCLUDE_DIRS})
 target_link_libraries(nnc_acl_soft_backend_system_test ${HDF5_CXX_LIBRARIES})
@@ -109,11 +100,11 @@ foreach(MODEL IN ITEMS ${MODELS})
     message("INPUT_FILE = ${INPUT_FILE}")
 
   # Generate the 'reference' output with NNKIT.
-  add_custom_target(${REFERENCE_OUTPUT_TARGET} ALL $<TARGET_FILE:nni>
+  add_custom_target(${REFERENCE_OUTPUT_TARGET} ALL $<TARGET_FILE:nnkit-run>
       --backend $<TARGET_FILE:nnkit_caffe_backend> --backend-arg ${INITIALIZED_MODEL_FILE}
       --pre $<TARGET_FILE:nnkit_HDF5_import_action> --pre-arg ${INPUT_FILE}
       --post $<TARGET_FILE:nnkit_HDF5_export_action> --post-arg ${REFERENCE_OUTPUT}
-      DEPENDS $<TARGET_FILE:nni> ${INPUT_TARGET} ${INITIALIZED_MODEL_TARGET})
+      DEPENDS $<TARGET_FILE:nnkit-run> ${INPUT_TARGET} ${INITIALIZED_MODEL_TARGET})
 
   # Generate an artifact from the model.
   add_custom_target(${ARTIFACT_TARGET} ALL $<TARGET_FILE:nnc>
index c63d1d2..c936f9e 100644 (file)
@@ -64,7 +64,7 @@ public:
 
     Tensor result(tr_shape);
     auto on_loop = [this, &reshape, &result](vector<int>& coords) {
-      vector<int> tr_coords;
+      vector<int> tr_coords(_shape.size());
 
       for (int i = 0; i < rank(); ++i)
         tr_coords[i] = coords[reshape[i]];
@@ -178,7 +178,6 @@ int main(int argc, char* argv[]) {
 
   Tensor caffe_tensor(dimensions);
   fillTensor(caffe_tensor);
-  dumpTensor(caffe_tensor);
   writeTensorToHDF5File(argv[1], "in_" + string(argv[2]) + "_caffe", caffe_tensor);
 
   vector<hsize_t> tf_reshape{0, 2, 3, 1};