libtorch学习第五

tensor的操作

#include
#include

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

int main()
{
	auto b = torch::ones({ 3,4 });
	auto c = torch::zeros({ 3,4 });
	auto cat = torch::cat({ b,c }, 1);
	//cout << cat << endl;
	
	auto stc = torch::stack({ b,c }, 1);
	//cout << stc << endl;

	/
	b = torch::rand({ 3,4 });
	c = torch::rand({ 3,4 });
	cout << b * c << endl;
	cout << b / c << endl;
	cout << b.mm(c.t()) << endl; // 矩阵乘法

	return 0;
}

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