mirror of
https://github.com/pytorch/pytorch.git
synced 2025-11-11 22:34:53 +08:00
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55073
Original diff D27422219 (d92e2520de) was reverted, reintroducing this op again.
Reviewed By: ChunliF
Differential Revision: D27473735
fbshipit-source-id: 1af0281724e9ada699ebf2045d51f65083daf5b4
35 lines
717 B
C++
35 lines
717 B
C++
#ifndef CAFFE2_OPERATORS_LOG1P_OP_H_
|
|
#define CAFFE2_OPERATORS_LOG1P_OP_H_
|
|
|
|
#include <vector>
|
|
|
|
#include "caffe2/operators/elementwise_ops.h"
|
|
#include "caffe2/utils/math.h"
|
|
|
|
namespace caffe2 {
|
|
|
|
template <class Context>
|
|
struct Log1pFunctor {
|
|
template <typename T>
|
|
bool operator()(const int N, const T* X, T* Y, Context* context) const {
|
|
math::Log1p(N, X, Y, context);
|
|
return true;
|
|
}
|
|
};
|
|
|
|
template <class Context>
|
|
struct Log1pGradientFunctor {
|
|
template <typename T>
|
|
bool Forward(
|
|
const std::vector<int>& X_dims,
|
|
const std::vector<int>& dY_dims,
|
|
const T* X,
|
|
const T* dY,
|
|
T* dX,
|
|
Context* context) const;
|
|
};
|
|
|
|
} // namespace caffe2
|
|
|
|
#endif // CAFFE2_OPERATORS_LOG1P_OP_H_
|