mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
gcc doesn't consider that
template<typename OtherDerived> TensorStridingOp& operator = (const OtherDerived& other) provides a valid assignment operator for the striding operation, and therefore refuses to compile code like: result.stride(foo) = source.stride(bar); Added the explicit TensorStridingOp& operator = (const TensorStridingOp& other) as a workaround to get the code to compile, and did the same in all the operations that can be used as lvalues.
This commit is contained in:
@@ -318,8 +318,29 @@ static void test_chip_as_lvalue()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Tensor<float, 5, DataLayout> input7(2,3,5,7,11);
|
||||
input7.setRandom();
|
||||
tensor = input1;
|
||||
tensor.chip(0, 0) = input7.chip(0, 0);
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
for (int k = 0; k < 5; ++k) {
|
||||
for (int l = 0; l < 7; ++l) {
|
||||
for (int m = 0; m < 11; ++m) {
|
||||
if (i != 0) {
|
||||
VERIFY_IS_EQUAL(tensor(i,j,k,l,m), input1(i,j,k,l,m));
|
||||
} else {
|
||||
VERIFY_IS_EQUAL(tensor(i,j,k,l,m), input7(i,j,k,l,m));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<int DataLayout>
|
||||
static void test_chip_raw_data()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user