From 611f946de6d2345dc05eb06578e90354c5e1961a Mon Sep 17 00:00:00 2001
From: Hashim Sharif <hsharif3@tyler.cs.illinois.edu>
Date: Sun, 23 Aug 2020 01:18:59 -0500
Subject: [PATCH] returning working directory from Keras frontend

---
 llvm/projects/keras/frontend/approxhpvm_translator.py | 5 ++++-
 llvm/projects/keras/src/Benchmark.py                  | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/llvm/projects/keras/frontend/approxhpvm_translator.py b/llvm/projects/keras/frontend/approxhpvm_translator.py
index aed8d30e75..bd30ad2a44 100644
--- a/llvm/projects/keras/frontend/approxhpvm_translator.py
+++ b/llvm/projects/keras/frontend/approxhpvm_translator.py
@@ -827,7 +827,8 @@ class TensorRtTranslator:
 
     self.add_header()
     
-    dir_path = "std::string dir_prefix = std::string(\"" + weights_dir + "\"); \n"
+    #dir_path = "std::string dir_prefix = std::string(\"" + weights_dir + "\"); \n"
+    dir_path = "std::string dir_prefix = std::string(\"../\"); \n"
     self.weight_str += dir_path
 
     if test_data is not None:
@@ -966,3 +967,5 @@ def translate_to_approxhpvm(model, weights_dir, test_data=None, test_labels=None
   hpvmTranslator.translate(model, weights_dir, test_data)
   
   
+  return weights_dir
+
diff --git a/llvm/projects/keras/src/Benchmark.py b/llvm/projects/keras/src/Benchmark.py
index e653e120dd..c206af332d 100644
--- a/llvm/projects/keras/src/Benchmark.py
+++ b/llvm/projects/keras/src/Benchmark.py
@@ -60,8 +60,11 @@ class Benchmark:
           print("ERROR: Must load HPVM model to invoke frontend - use 'hpvm_reload'")
           sys.exit(1)
 
-        translate_to_approxhpvm(model, self.hpvm_dir, X_test, Y_test, self.num_classes)
+        working_dir = translate_to_approxhpvm(model, self.hpvm_dir, X_test, Y_test, self.num_classes)
+        print ("*** working_dir = ", working_dir)
+        
 
 
+        
 
 
-- 
GitLab