Skip to content
Snippets Groups Projects
Commit c4844087 authored by auphelia's avatar auphelia
Browse files

[Test] Changed execute_custom_node.py and test cpp file to check if passing...

[Test] Changed execute_custom_node.py and test cpp file to check if passing arrays via .npy files works
parent ff70166f
No related branches found
No related tags found
No related merge requests found
......@@ -17,9 +17,12 @@ def execute_custom_node(node, context, graph):
in_ind = 0
temp_files = []
for inputs in node.input:
np.save("input_{}.npy".format(in_ind), context[inputs].astype(np.float32))
np.save("input_{}.npy".format(in_ind), context[inputs])
temp_files.append("input_{}.npy".format(in_ind))
in_ind += 1
output = np.load("output.npy")
print(output)
code_gen.execute(node, context, graph)
## deleting temporary files
......
File added
#include "cnpy.h"
#include<iostream>
#include<complex>
#include<cstdlib>
#include<iostream>
#include<map>
#include<string>
int main(){
std::cout << "TEST" << std::endl;
cnpy::NpyArray arr = cnpy::npy_load("input_0.npy");
std::complex<double>* loaded_data = arr.data<std::complex<double>>();
std::cout << loaded_data << std::endl;
float* loaded_data = arr.data<float>();
std::cout << arr.shape.size() << std::endl;
int Nx = arr.shape[0];
int Ny = arr.shape[1];
int Nz = arr.shape[2];
for(int i = 0; i < Nx*Ny*Nz;i++) {
std::cout << loaded_data[i] << std::endl;
}
cnpy::npy_save("output.npy",&loaded_data[0],{Nx,Ny,Nz},"w");
}
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment