mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
Made the cxx11_tensor_forced_eval compile without c++11.
This commit is contained in:
parent
46bcb70969
commit
1131a984a6
@ -22,14 +22,15 @@ static void test_simple()
|
|||||||
m1.setRandom();
|
m1.setRandom();
|
||||||
m2.setRandom();
|
m2.setRandom();
|
||||||
|
|
||||||
TensorMap<Tensor<float, 2>> mat1(m1.data(), 3,3);
|
TensorMap<Tensor<float, 2> > mat1(m1.data(), 3,3);
|
||||||
TensorMap<Tensor<float, 2>> mat2(m2.data(), 3,3);
|
TensorMap<Tensor<float, 2> > mat2(m2.data(), 3,3);
|
||||||
|
|
||||||
Tensor<float, 2> mat3(3,3);
|
Tensor<float, 2> mat3(3,3);
|
||||||
mat3 = mat1;
|
mat3 = mat1;
|
||||||
|
|
||||||
typedef Tensor<float, 1>::DimensionPair DimPair;
|
typedef Tensor<float, 1>::DimensionPair DimPair;
|
||||||
Eigen::array<DimPair, 1> dims({{DimPair(1, 0)}});
|
Eigen::array<DimPair, 1> dims;
|
||||||
|
dims[0] = DimPair(1, 0);
|
||||||
|
|
||||||
mat3 = mat3.contract(mat2, dims).eval();
|
mat3 = mat3.contract(mat2, dims).eval();
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ static void test_const()
|
|||||||
Eigen::array<int, 2> bcast;
|
Eigen::array<int, 2> bcast;
|
||||||
bcast[0] = 3;
|
bcast[0] = 3;
|
||||||
bcast[1] = 1;
|
bcast[1] = 1;
|
||||||
const TensorMap<Tensor<const float, 2>> input_tensor(input.data(), 3, 3);
|
const TensorMap<Tensor<const float, 2> > input_tensor(input.data(), 3, 3);
|
||||||
Tensor<float, 2> output_tensor= (input_tensor - input_tensor.maximum(depth_dim).eval().reshape(dims2d).broadcast(bcast));
|
Tensor<float, 2> output_tensor= (input_tensor - input_tensor.maximum(depth_dim).eval().reshape(dims2d).broadcast(bcast));
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user