-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add aten::_ctc_loss and its variants (#925)
- [x] _ctc_loss - [x] _ctc_loss.Tensor - [x] _ctc_loss_backward - [x] _ctc_loss_backward.Tensor
- Loading branch information
Showing
6 changed files
with
1,363 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include <ATen/core/Reduction.h> | ||
#include <ATen/core/Tensor.h> | ||
#include <ATen/native/xpu/sycl/LossCTCKernels.h> | ||
#include <comm/RegisterUtils.h> | ||
|
||
namespace at { | ||
namespace native { | ||
|
||
std::tuple<Tensor, Tensor> ctc_loss_xpu( | ||
const Tensor& log_probs, | ||
const Tensor& targets, | ||
IntArrayRef input_lengths, | ||
IntArrayRef target_lengths, | ||
int64_t blank, | ||
bool zero_infinity) { | ||
return native::xpu::ctc_loss_kernel( | ||
log_probs, targets, input_lengths, target_lengths, blank, zero_infinity); | ||
} | ||
|
||
Tensor ctc_loss_backward_xpu( | ||
const Tensor& grad, | ||
const Tensor& log_probs, | ||
const Tensor& targets, | ||
IntArrayRef input_lengths, | ||
IntArrayRef target_lengths, | ||
const Tensor& neg_log_likelihood, | ||
const Tensor& log_alpha, | ||
int64_t blank, | ||
bool zero_infinity) { | ||
return native::xpu::ctc_loss_backward_kernel( | ||
grad, | ||
log_probs, | ||
targets, | ||
input_lengths, | ||
target_lengths, | ||
neg_log_likelihood, | ||
log_alpha, | ||
blank, | ||
zero_infinity); | ||
} | ||
|
||
} // namespace native | ||
} // namespace at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.