libtorch学习第三

形状变换

#include
#include

using std::cout; using std::endl;

int main()
{
	auto b = torch::full({ 10 }, 3);
	//cout << b << endl;
	b = b.view({ 1,2,-1 });
	//cout << b << endl;

	auto c = b.transpose(0, 1);
	//cout << c << endl;

	auto d = b.reshape({ 1,1,-1 });
	//cout << d << endl;

	auto e = b.permute({ 1,0,2 });
	cout << e << endl;

	return 0;
}

你可能感兴趣的:(pytorch,学习,算法)