12 #include <Eigen/CXX11/Tensor> 25 template <
typename Output,
typename Device>
31 output.stride(strides).device(device) = input;
35 output.slice(offsets, extents).stride(strides).device(device) = input.constant(0.0
f);
48 for (
int i = 0;
i < 6;
i+=2) {
49 for (
int j = 0;
j < 10;
j+=2) {
53 for (
int i = 1;
i < 6;
i+=2) {
54 for (
int j = 1;
j < 10;
j+=2) {
70 template <
typename Output,
typename Device>
72 Output& output,
const Device& device)
const 77 for (
int i = 0;
i < output.dimension(2); ++
i) {
78 output.template chip<2>(
i).device(device) = input1.
chip<2>(
i).contract(input2.
chip<2>(
i), dims);
92 for (
int i = 0;
i < 5; ++
i) {
98 for (
int j = 0;
j < 2; ++
j) {
99 for (
int k = 0; k < 7; ++k) {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorChippingOp< DimId, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > chip(const Index offset) const
static void test_custom_unary_op()
DSizes< DenseIndex, 3 > dimensions(const Tensor< float, 3 > &input1, const Tensor< float, 3 > &input2) const
DSizes< DenseIndex, 2 > dimensions(const Tensor< float, 2 > &input) const
#define VERIFY_IS_APPROX(a, b)
#define VERIFY_IS_EQUAL(a, b)
Tensor< float, 1 >::DimensionPair DimPair
EIGEN_ALWAYS_INLINE DSizes< IndexType, NumDims > strides(const DSizes< IndexType, NumDims > &dimensions)
EIGEN_DECLARE_TEST(cxx11_tensor_custom_op)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set offsets
void eval(const Tensor< float, 2 > &input, Output &output, const Device &device) const
#define CALL_SUBTEST(FUNC)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index dimension(std::size_t n) const
void eval(const Tensor< float, 3 > &input1, const Tensor< float, 3 > &input2, Output &output, const Device &device) const
A reference to a tensor expression The expression will be evaluated lazily (as much as possible)...
static void test_custom_binary_op()