Skip to content

Commit b51ba2c

Browse files
committed
code review comments
1 parent 84f13e5 commit b51ba2c

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

caffe2/core/operator.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,7 @@ unique_ptr<OperatorBase> TryCreateC2Operator(
100100

101101
unique_ptr<OperatorBase> TryCreateC10Operator(
102102
const string& key, const OperatorDef& operator_def, Workspace* ws) {
103-
if (auto op = C10OperatorRegistry()->Create(key, operator_def, ws)) {
104-
return op;
105-
}
106-
return nullptr;
103+
return C10OperatorRegistry()->Create(key, operator_def, ws);
107104
}
108105

109106
unique_ptr<OperatorBase> TryCreateOperator(

caffe2/operators/c10_sigmoid_op.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#pragma once
22

3-
#include "../core/tensor.h"
3+
#include "caffe2/core/tensor.h"
44
#include "caffe2/utils/Array.h"
55

66
namespace caffe2 {
77

88
struct SigmoidOp final {
99
static constexpr const char* name = "sigmoid";
1010

11-
using Signature = bool(Tensor<CPUContext> input, Tensor<CPUContext>* output);
11+
using Signature = void(Tensor<CPUContext> input, Tensor<CPUContext>* output);
1212

1313
static constexpr c10::guts::array<const char*, 2> parameter_names = {{"input", "output"}};
1414
};

caffe2/operators/c10_sigmoid_op_cpu.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ using caffe2::CPUContext;
77

88
namespace {
99
template<class DataType>
10-
bool sigmoid_op_cpu_impl(Tensor<CPUContext> input, Tensor<CPUContext> *output) {
10+
void sigmoid_op_cpu_impl(Tensor<CPUContext> input, Tensor<CPUContext> *output) {
1111
output->ResizeLike(input);
1212

1313
caffe2::ConstEigenVectorArrayMap<DataType> xM(input.data<DataType>(), input.size());
1414
caffe2::EigenVectorArrayMap<DataType>(output->mutable_data<DataType>(), input.size()) = 1. / (1. + (-xM).exp());
15-
16-
return true;
1715
}
1816
} // namespace
1917

0 commit comments

Comments
 (0)