forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Pull Request resolved: pytorch#20820 Reviewed By: dzhulgakov Differential Revision: D15455866 fbshipit-source-id: 712b06dfbd441051dc284a1acdf94926df09bc1d
- Loading branch information
1 parent
8dedb04
commit 70caa2e
Showing
3 changed files
with
63 additions
and
0 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,46 @@ | ||
#include <ATen/ATen.h> | ||
#include <ATen/Config.h> | ||
#include <ATen/NativeFunctions.h> | ||
|
||
#if !AT_MKLDNN_ENABLED() | ||
|
||
namespace at { | ||
namespace native { | ||
|
||
Tensor mkldnn_sigmoid(const Tensor& self) { | ||
AT_ERROR("mkldnn_sigmoid: ATen not compiled with MKLDNN support"); | ||
} | ||
|
||
Tensor& mkldnn_sigmoid_(Tensor& self) { | ||
AT_ERROR("mkldnn_sigmoid_: ATen not compiled with MKLDNN support"); | ||
} | ||
|
||
} // namespace native | ||
} // namespace at | ||
|
||
#else // AT_MKLDNN_EBABLED | ||
|
||
#include <ATen/native/mkldnn/MKLDNNCommon.h> | ||
|
||
namespace at { | ||
namespace native { | ||
|
||
Tensor mkldnn_sigmoid(const Tensor& self) { | ||
ideep::tensor& x = itensor_from_mkldnn(self); | ||
ideep::tensor y; | ||
ideep::eltwise_forward::compute( | ||
x, y, ideep::algorithm::eltwise_logistic, ideep::prop_kind::forward); | ||
return new_with_itensor_mkldnn(std::move(y), self.options()); | ||
} | ||
|
||
Tensor& mkldnn_sigmoid_(Tensor& self) { | ||
ideep::tensor& x = itensor_from_mkldnn(self); | ||
ideep::eltwise_forward::compute( | ||
x, x, ideep::algorithm::eltwise_logistic, ideep::prop_kind::forward); | ||
return self; | ||
} | ||
|
||
} // namespace native | ||
} // namespace at | ||
|
||
#endif // AT_MKLDNN_EBABLED |
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
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