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.
14 lines
558 B
14 lines
558 B
#include "utils.h"
|
|
#include <torch/torch.h>
|
|
#include <string>
|
|
#include <iostream>
|
|
|
|
void save_tensor_to_file(const torch::Tensor& tensor, const std::string& file_path) {
|
|
try {
|
|
std::cout << "[DEBUG] Entering save_tensor_to_file for: " << file_path << ", tensor shape: " << tensor.sizes() << std::endl;
|
|
torch::save(tensor, file_path);
|
|
std::cout << "Saved tensor to: " << file_path << std::endl;
|
|
} catch (const c10::Error& e) {
|
|
std::cerr << "Error saving tensor to " << file_path << ": " << e.what() << std::endl;
|
|
}
|
|
}
|