8000 Implement logaddexp by cloudhan · Pull Request #38384 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Implement logaddexp #38384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add cuda logaddexp
  • Loading branch information
cloudhan committed May 23, 2020
commit c4730a3efe6297019c46d33cf175b00addf98a9c
10 changes: 10 additions & 0 deletions aten/src/ATen/native/cuda/BinaryMiscOpsKernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ void mse_kernel_cuda(TensorIterator& iter) {
});
}

void logaddexp_kernel_cuda(TensorIterator& iter) {
AT_DISPATCH_FLOATING_TYPES_AND_HALF(iter.dtype(), "logaddexp_cuda", [&]() {
gpu_kernel(iter, [] GPU_LAMBDA (scalar_t a, scalar_t b) -> scalar_t {
scalar_t m = ::max(a, b);
return m + ::log((scalar_t)(1.0) + ::exp(-::abs(a - b)));
});
});
}

REGISTER_DISPATCH(atan2_stub, &atan2_kernel_cuda);
REGISTER_DISPATCH(smooth_l1_stub, &smooth_l1_kernel_cuda);
REGISTER_DISPATCH(mse_stub, &mse_kernel_cuda);
REGISTER_DISPATCH(logaddexp_stub, &logaddexp_kernel_cuda);

}} // namespace at::native
0