/external/eigen/unsupported/test/ |
cxx11_tensor_custom_index.cpp | 15 #include <Eigen/CXX11/Tensor> 17 using Eigen::Tensor; 24 Tensor<float, 4, DataLayout> tensor(2, 3, 5, 7); 25 tensor.setRandom(); 36 VERIFY_IS_EQUAL(tensor.coeff(coeffC), tensor.coeff(coeff)); 37 VERIFY_IS_EQUAL(tensor.coeffRef(coeffC), tensor.coeffRef(coeff)); 46 Tensor<float, 4, DataLayout> tensor(2, 3, 5, 7) [all...] |
cxx11_tensor_argmax.cpp | 13 #include <Eigen/CXX11/Tensor> 15 using Eigen::Tensor; 22 Tensor<float, 4, DataLayout> tensor(2,3,5,7); 23 tensor.setRandom(); 24 tensor = (tensor + tensor.constant(0.5)).log(); 26 Tensor<Tuple<DenseIndex, float>, 4, DataLayout> index_tuples(2,3,5,7); 27 index_tuples = tensor.index_tuples() [all...] |
cxx11_tensor_layout_swap.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 18 Tensor<float, 3, ColMajor> tensor(2,3,7); 19 tensor.setRandom(); 21 Tensor<float, 3, RowMajor> tensor2 = tensor.swap_layout(); 22 VERIFY_IS_EQUAL(tensor.dimension(0), tensor2.dimension(2)); 23 VERIFY_IS_EQUAL(tensor.dimension(1), tensor2.dimension(1)); 24 VERIFY_IS_EQUAL(tensor.dimension(2), tensor2.dimension(0)) [all...] |
cxx11_tensor_scan.cpp | 13 #include <Eigen/CXX11/Tensor> 15 using Eigen::Tensor; 21 Tensor<Type, 1, DataLayout> tensor(size); 22 tensor.setRandom(); 23 Tensor<Type, 1, DataLayout> result = tensor.cumsum(0, Exclusive); 25 VERIFY_IS_EQUAL(tensor.dimension(0), result.dimension(0)); 31 accum += tensor(i); 33 accum += tensor(i) [all...] |
cxx11_tensor_io.cpp | 13 #include <Eigen/CXX11/Tensor> 19 Tensor<int, 0, DataLayout> tensor; local 20 tensor() = 123; 23 os << tensor; local 33 Tensor<int, 1, DataLayout> tensor(5); 35 tensor(i) = i; 39 os << tensor; local 44 Eigen::Tensor<double,1,DataLayout> empty_tensor(0) 63 os << tensor; local 97 os << tensor; local [all...] |
cxx11_tensor_chipping.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 19 Tensor<float, 5, DataLayout> tensor(2,3,5,7,11); 20 tensor.setRandom(); 22 Tensor<float, 4, DataLayout> chip1; 23 chip1 = tensor.template chip<0>(1); 34 VERIFY_IS_EQUAL(chip1(i,j,k,l), tensor(1,i,j,k,l)); 40 Tensor<float, 4, DataLayout> chip2 = tensor.template chip<1>(1) 224 Tensor<float, 5, DataLayout> tensor = input1; local [all...] |
cxx11_tensor_striding.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 19 Tensor<float, 4, DataLayout> tensor(2,3,5,7); 20 tensor.setRandom(); 27 Tensor<float, 4, DataLayout> no_stride; 28 no_stride = tensor.stride(strides); 39 VERIFY_IS_EQUAL(tensor(i,j,k,l), no_stride(i,j,k,l)); 49 Tensor<float, 4, DataLayout> stride; 50 stride = tensor.stride(strides) [all...] |
cxx11_tensor_inflation.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 19 Tensor<float, 4, DataLayout> tensor(2,3,5,7); 20 tensor.setRandom(); 28 Tensor<float, 4, DataLayout> no_stride; 29 no_stride = tensor.inflate(strides); 40 VERIFY_IS_EQUAL(tensor(i,j,k,l), no_stride(i,j,k,l)); 50 Tensor<float, 4, DataLayout> inflated; 51 inflated = tensor.inflate(strides) [all...] |
cxx11_tensor_broadcasting.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 19 Tensor<float, 4, DataLayout> tensor(2,3,5,7); 20 tensor.setRandom(); 27 Tensor<float, 4, DataLayout> no_broadcast; 28 no_broadcast = tensor.broadcast(broadcasts); 39 VERIFY_IS_EQUAL(tensor(i,j,k,l), no_broadcast(i,j,k,l)); 49 Tensor<float, 4, DataLayout> broadcast; 50 broadcast = tensor.broadcast(broadcasts) [all...] |
cxx11_tensor_morphing.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 19 Tensor<float, 5> tensor1(2,3,1,7,1); 22 Tensor<float, 3> tensor2(2,3,7); 23 Tensor<float, 2> tensor3(6,7); 24 Tensor<float, 2> tensor4(2,21); 26 Tensor<float, 3>::Dimensions dim1(2,3,7); 28 Tensor<float, 2>::Dimensions dim2(6,7); 30 Tensor<float, 2>::Dimensions dim3(2,21); 52 TensorMap<Tensor<float, 5>> tensor1(m1.data(), 2,3,5,7,11) 449 Eigen::Tensor<float, 3, DataLayout> tensor = local [all...] |
cxx11_tensor_shuffling.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 20 Tensor<float, 4, DataLayout> tensor(2,3,5,7); 21 tensor.setRandom(); 28 Tensor<float, 4, DataLayout> no_shuffle; 29 no_shuffle = tensor.shuffle(shuffles); 40 VERIFY_IS_EQUAL(tensor(i,j,k,l), no_shuffle(i,j,k,l)); 50 Tensor<float, 4, DataLayout> shuffle; 51 shuffle = tensor.shuffle(shuffles) [all...] |
cxx11_tensor_reduction.cpp | 13 #include <Eigen/CXX11/Tensor> 15 using Eigen::Tensor; 20 Tensor<float, 0, DataLayout> tensor; local 21 tensor.setRandom(); 24 Tensor<float, 0, DataLayout> result = tensor.sum(reduction_axis); 25 VERIFY_IS_EQUAL(result(), tensor()); 29 Tensor<float, 1, DataLayout> tensor(7) [all...] |
cxx11_tensor_volume_patch.cpp | 3 #include <Eigen/CXX11/Tensor> 5 using Eigen::Tensor; 9 Tensor<float, 5> tensor(4,2,3,5,7); 10 tensor.setRandom(); 11 Tensor<float, 5, RowMajor> tensor_row_major = tensor.swap_layout(); 13 Tensor<float, 6> single_voxel_patch; 14 single_voxel_patch = tensor.extract_volume_patches(1, 1, 1); 22 Tensor<float, 6, RowMajor> single_voxel_patch_row_major [all...] |
cxx11_tensor_padding.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 19 Tensor<float, 4, DataLayout> tensor(2,3,5,7); 20 tensor.setRandom(); 28 Tensor<float, 4, DataLayout> padded; 29 padded = tensor.pad(paddings); 41 VERIFY_IS_EQUAL(padded(i,j,k,l), tensor(i,j-2,k-3,l)); 54 Tensor<float, 4, DataLayout> tensor(2,3,5,7) [all...] |
cxx11_tensor_ifft.cpp | 13 #include <Eigen/CXX11/Tensor> 15 using Eigen::Tensor; 19 Tensor<double, 1, DataLayout> tensor(sequence_length); 20 tensor.setRandom(); 25 Tensor<std::complex<double>, 1, DataLayout> tensor_after_fft; 26 Tensor<std::complex<double>, 1, DataLayout> tensor_after_fft_ifft; 28 tensor_after_fft = tensor.template fft<Eigen::BothParts, Eigen::FFT_FORWARD>(fft); 35 VERIFY_IS_APPROX(static_cast<float>(tensor(i)), static_cast<float>(std::real(tensor_after_fft_ifft(i)))); 41 Tensor<double, 2, DataLayout> tensor(dim0, dim1) [all...] |
cxx11_tensor_patch.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 19 Tensor<float, 4, DataLayout> tensor(2,3,5,7); 20 tensor.setRandom(); 28 Tensor<float, 5, DataLayout> no_patch; 29 no_patch = tensor.extract_patches(patch_dims); 36 VERIFY_IS_EQUAL(no_patch.dimension(4), tensor.size()); 38 VERIFY_IS_EQUAL(no_patch.dimension(0), tensor.size()); 45 for (int i = 0; i < tensor.size(); ++i) [all...] |
cxx11_tensor_reverse.cpp | 13 #include <Eigen/CXX11/Tensor> 15 using Eigen::Tensor; 21 Tensor<float, 4, DataLayout> tensor(2,3,5,7); 22 tensor.setRandom(); 30 Tensor<float, 4, DataLayout> reversed_tensor; 31 reversed_tensor = tensor.reverse(dim_rev); 42 VERIFY_IS_EQUAL(tensor(i,j,k,l), reversed_tensor(i,2-j,4-k,l)); 53 reversed_tensor = tensor.reverse(dim_rev); 65 VERIFY_IS_EQUAL(tensor(i,j,k,l), reversed_tensor(1-i,j,k,l)) [all...] |
cxx11_tensor_image_patch.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 18 Tensor<float, 4> tensor(2,3,5,7); 19 tensor.setRandom(); 20 Tensor<float, 4, RowMajor> tensor_row_major = tensor.swap_layout(); 21 VERIFY_IS_EQUAL(tensor.dimension(0), tensor_row_major.dimension(3)); 22 VERIFY_IS_EQUAL(tensor.dimension(1), tensor_row_major.dimension(2)); 23 VERIFY_IS_EQUAL(tensor.dimension(2), tensor_row_major.dimension(1)) [all...] |
cxx11_tensor_index_list.cpp | 12 #include <Eigen/CXX11/Tensor> 18 Tensor<float, 4> tensor(2,3,5,7); 19 tensor.setRandom(); 33 Tensor<float, 1> result = tensor.sum(reduction_axis); 39 expected += tensor(j,k,l,i); 50 Tensor<float, 5> tensor(2,3,5,7,11); 51 tensor.setRandom() [all...] |
cxx11_tensor_ref.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 19 Tensor<int, 1> input(6); 22 TensorRef<Tensor<int, 1>> ref3(input); 23 TensorRef<Tensor<int, 1>> ref4 = input; 50 Tensor<int, 1> input1(6); 52 Tensor<int, 1> input2(6); 55 TensorRef<Tensor<int, 1>> ref3(input1 + input2); 56 TensorRef<Tensor<int, 1>> ref4 = input1 + input2; 72 Tensor<float, 3> input(3,5,7) [all...] |
cxx11_tensor_assign.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 19 Tensor<int, 1> vec1(6); 20 Tensor<int, 1, RowMajor> vec2(6); 32 TensorMap<Tensor<int, 1> > vec3(col_major, 6); 33 TensorMap<Tensor<int, 1, RowMajor> > vec4(row_major, 6); 74 Tensor<int, 2> mat1(2,3); 75 Tensor<int, 2, RowMajor> mat2(2,3); 95 TensorMap<Tensor<int, 2> > mat3(row_major, 2, 3); 96 TensorMap<Tensor<int, 2, RowMajor> > mat4(col_major, 2, 3) 263 Tensor<int, 1> tensor = start_tensor; local [all...] |
cxx11_tensor_custom_op.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 18 DSizes<DenseIndex, 2> dimensions(const Tensor<float, 2>& input) const { 26 void eval(const Tensor<float, 2>& input, Output& output, const Device& device) const 41 Tensor<float, 2> tensor(3,5); 42 tensor.setRandom(); 44 Tensor<float, 2> result = tensor.customOp(InsertZeros()); 50 VERIFY_IS_EQUAL(result(i, j), tensor(i/2, j/2)) [all...] |
cxx11_tensor_map.cpp | 12 #include <Eigen/CXX11/Tensor> 14 using Eigen::Tensor; 19 Tensor<int, 0> scalar1; 20 Tensor<int, 0, RowMajor> scalar2; 22 TensorMap<Tensor<const int, 0> > scalar3(scalar1.data()); 23 TensorMap<Tensor<const int, 0, RowMajor> > scalar4(scalar2.data()); 37 Tensor<int, 1> vec1(6); 38 Tensor<int, 1, RowMajor> vec2(6); 40 TensorMap<Tensor<const int, 1> > vec3(vec1.data(), 6); 41 TensorMap<Tensor<const int, 1, RowMajor> > vec4(vec2.data(), 6) [all...] |
/external/eigen/unsupported/Eigen/CXX11/src/Tensor/ |
TensorIO.h | 17 // Print the tensor as a 2d matrix 18 template <typename Tensor, int Rank> 20 static void run (std::ostream& os, const Tensor& tensor) { 21 typedef typename internal::remove_const<typename Tensor::Scalar>::type Scalar; 22 typedef typename Tensor::Index Index; 23 const Index total_size = internal::array_prod(tensor.dimensions()); 25 const Index first_dim = Eigen::internal::array_get<0>(tensor.dimensions()); 26 static const int layout = Tensor::Layout; 27 Map<const Array<Scalar, Dynamic, Dynamic, layout> > matrix(const_cast<Scalar*>(tensor.data()), first_dim, total_size/first_dim) [all...] |
TensorInitializer.h | 31 static void run(TensorEvaluator<Derived, DefaultDevice>& tensor, 37 Initializer<Derived, N - 1>::run(tensor, indices, v); 46 static void run(TensorEvaluator<Derived, DefaultDevice>& tensor, 53 tensor.coeffRef(*indices) = v; 62 static void run(TensorEvaluator<Derived, DefaultDevice>& tensor, 65 tensor.coeffRef(0) = v; 71 void initialize_tensor(TensorEvaluator<Derived, DefaultDevice>& tensor, 74 Initializer<Derived, traits<Derived>::NumDimensions>::run(tensor, &indices, vals);
|