diff --git a/tools/web-exporter/export-scope.cpp b/tools/web-exporter/export-scope.cpp index 62a47e8c7f4f438b95d0d452f4471bb6517db86e..d5c2492ac74129fce25eb56dc9fc870e66f2dccc 100644 --- a/tools/web-exporter/export-scope.cpp +++ b/tools/web-exporter/export-scope.cpp @@ -10,17 +10,24 @@ void export_scope(ProgramPtr program, ScopePtr scope, const std::string & dirnam if (var->Persistable()) { auto* v = scope->FindVar(var->Name()); assert(v != nullptr); - const float * p = v->Get(); int count = 1; for (auto n: var->Tensor_desc().Dims()) { count *= n; } + + auto* tensor = v->GetMutable(); + const float * p = tensor->mutable_data(); + std::string para_file_name = dirname + '/' + var->Name(); FILE *para_file = fopen(para_file_name.c_str(), "w"); assert(p != nullptr); - // std::cout << var->Name() << " " << count << "\n"; fwrite(p, sizeof(float), count, para_file); fclose(para_file); + // std::cout << "==> " << var->Name() << " " << count << "\n"; + // for (int i = 0; i < count; i++) { + // std::cout << p[i] << ", "; + // } + // std::cout << "\n"; } } }