You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					38 lines
				
				997 B
			
		
		
			
		
	
	
					38 lines
				
				997 B
			| 
								 
											7 years ago
										 
									 | 
							
								#ifndef SNPEMODEL_H
							 | 
						||
| 
								 | 
							
								#define SNPEMODEL_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include <SNPE/SNPE.hpp>
							 | 
						||
| 
								 | 
							
								#include <SNPE/SNPEBuilder.hpp>
							 | 
						||
| 
								 | 
							
								#include <SNPE/SNPEFactory.hpp>
							 | 
						||
| 
								 | 
							
								#include <DlContainer/IDlContainer.hpp>
							 | 
						||
| 
								 | 
							
								#include <DlSystem/DlError.hpp>
							 | 
						||
| 
								 | 
							
								#include <DlSystem/ITensor.hpp>
							 | 
						||
| 
								 | 
							
								#include <DlSystem/ITensorFactory.hpp>
							 | 
						||
| 
								 | 
							
								#include <DlSystem/IUserBuffer.hpp>
							 | 
						||
| 
								 | 
							
								#include <DlSystem/IUserBufferFactory.hpp>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class SNPEModel {
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 | 
							
								  SNPEModel(const uint8_t *model_data, const size_t model_size, float *output, size_t output_size);
							 | 
						||
| 
								 | 
							
								  void addRecurrent(float *state, int state_size);
							 | 
						||
| 
								 | 
							
								  void execute(float *net_input_buf);
							 | 
						||
| 
								 | 
							
								private:
							 | 
						||
| 
								 | 
							
								  // snpe model stuff
							 | 
						||
| 
								 | 
							
								  std::unique_ptr<zdl::SNPE::SNPE> snpe;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // snpe input stuff
							 | 
						||
| 
								 | 
							
								  zdl::DlSystem::UserBufferMap inputMap;
							 | 
						||
| 
								 | 
							
								  std::unique_ptr<zdl::DlSystem::IUserBuffer> inputBuffer;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // snpe output stuff
							 | 
						||
| 
								 | 
							
								  zdl::DlSystem::UserBufferMap outputMap;
							 | 
						||
| 
								 | 
							
								  std::unique_ptr<zdl::DlSystem::IUserBuffer> outputBuffer;
							 | 
						||
| 
								 | 
							
								  float *output;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // recurrent
							 | 
						||
| 
								 | 
							
								  std::unique_ptr<zdl::DlSystem::IUserBuffer> recurrentBuffer;
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 |