mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-07 18:27:40 +08:00
Add unit test for -Tensor<complex> on GPU
This commit is contained in:
parent
12e1ebb68b
commit
44ea5f7623
@ -48,11 +48,13 @@ void test_cuda_complex_cwise_ops() {
|
||||
Add = 0,
|
||||
Sub,
|
||||
Mul,
|
||||
Div
|
||||
Div,
|
||||
Neg,
|
||||
NbOps
|
||||
};
|
||||
|
||||
Tensor<std::complex<T>, 1, 0, int> actual(kNumItems);
|
||||
for (int op = Add; op <= Div; op++) {
|
||||
for (int op = Add; op < NbOps; op++) {
|
||||
std::complex<T> expected;
|
||||
switch (static_cast<CwiseOp>(op)) {
|
||||
case Add:
|
||||
@ -71,6 +73,10 @@ void test_cuda_complex_cwise_ops() {
|
||||
gpu_out.device(gpu_device) = gpu_in1 / gpu_in2;
|
||||
expected = a / b;
|
||||
break;
|
||||
case Neg:
|
||||
gpu_out.device(gpu_device) = -gpu_in1;
|
||||
expected = -a;
|
||||
break;
|
||||
}
|
||||
assert(cudaMemcpyAsync(actual.data(), d_out, complex_bytes, cudaMemcpyDeviceToHost,
|
||||
gpu_device.stream()) == cudaSuccess);
|
||||
|
Loading…
Reference in New Issue
Block a user