#include <map>
#include <vector>
#include <fstream>
+#include <sstream>
#include "PluginParam.h"
#include "PluginInstance.h"
auto f = fopen(params["filename"].c_str(), "rb");
fseek(f, 0L, SEEK_END);
auto len = ftell(f);
+ auto tensorSize = num_elements(shape) * sizeof(float);
+
+ // Check size
+ if (len != tensorSize) {
+ std::stringstream info;
+ info << "Wrong input file size <" << params["filename"] << "> = " << len << ". Should be :" << tensorSize;
+ throw PluginException(info.str());
+ }
+
rewind(f);
auto data = new char[len];
auto rlen = fread(data, len, 1, f);