Skip to content

Commit d9c0370

Browse files
committed
Fix[hardware_predict]: Fixed working directory changing
1 parent 0902ba6 commit d9c0370

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hls4ml/backends/vitis_accelerator/vitis_accelerator_backend.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def hardware_predict(self, model, x, target="hw", debug=False, profilingRepeat=-
167167
print(f"X_test_flat_shape: {X_test_size}")
168168

169169
# Change working directory to the HLS project directory
170+
currdir = os.getcwd()
170171
os.chdir(model.config.get_output_dir())
171172

172173
# Check if the shared library exists
@@ -184,7 +185,8 @@ def hardware_predict(self, model, x, target="hw", debug=False, profilingRepeat=-
184185
lib.predict(X_test_flat, X_test_size, predictions_ptr, predictions_size)
185186

186187
# Change back to the original directory
187-
os.chdir('../..')
188+
os.chdir(currdir)
189+
188190

189191
# Reshape the predictions to match the expected output shape
190192
y_hls = predictions.reshape(-1, sampleOutputSIze)[:originalSampleCount, :]

0 commit comments

Comments
 (0)