I tried your suggestion, however, I find using clone() is slower than giving value one by one, here is my test code:
#include <torch/torch.h>
#include <iostream>
#include <vector>
#include <typeinfo>
#include <ctime>
#include <opencv2/core/core.hpp> 
#include "opencv2/imgproc.hpp"
#include<opencv2/highgui/highgui.hpp>
#include<windows.h>
using namespace std;
int main() {
	LARGE_INTEGER nFreq;
	LARGE_INTEGER start, end;int length = 200000;
	int class_num = 5;
	vector<vector<float>> test_vector;
	vector<float> tmp_h_list;
	for (int i = 0; i < length; ++i) {
		tmp_h_list.clear();
		for (int j = 0; j < class_num; ++j) {
			tmp_h_list.push_back(i*j);
		};
		test_vector.push_back(tmp_h_list);
	};
	QueryPerformanceFrequency(&nFreq);
	QueryPerformanceCounter(&start);
	torch::Tensor y = torch::zeros({ length, class_num }, torch::kFloat32);
	QueryPerformanceCounter(&end);
	cout <<"init y: "<< (double)(end.QuadPart - start.QuadPart)/ (double)nFreq.QuadPart *1000 << "ms" << endl;
	QueryPerformanceCounter(&start);
	torch::Tensor yc = torch::clone(y);
	QueryPerformanceCounter(&end);
	cout << "clone y: " << (double)(end.QuadPart - start.QuadPart) / (double)nFreq.QuadPart * 1000 << "ms" << endl;
	QueryPerformanceCounter(&start);
	float* tmp_ptr = y.data<float>();
	for (int i = 0; i < length; ++i) {
		for (int j = 0; j < class_num; ++j) {
			*tmp_ptr++ = test_vector[i][j];
		};
	};
	QueryPerformanceCounter(&end);
	cout << "clone one by one: " << (double)(end.QuadPart - start.QuadPart) / (double)nFreq.QuadPart * 1000 << "ms" << endl;
	system("pause");
}

result is
init y: 2.28433ms
clone y: 2.98833ms
clone one by one: 2.05215ms

I also find there will be a error when trying to clone a Tensor created by from_blob(<vector<…>>*):
Exception thrown at 0x00007FFC4256E210 (caffe2.dll) (in example-app.exe): 0xC0000005: An access violation occurred while reading location 0x000000AB84B00000.

Thanks a lot for your time