Caffe2 - C++ API
A deep learning, cross platform ML framework
if_op.cc
1 
17 #include "caffe2/operators/if_op.h"
18 
19 namespace caffe2 {
20 
21 REGISTER_CPU_OPERATOR(If, IfOp<CPUContext>);
22 
23 OPERATOR_SCHEMA(If)
24  .NumInputs(1, INT_MAX)
25  .NumOutputs(0, INT_MAX)
26  .SetDoc(R"DOC(
27 'If' control operator, first input is a scalar boolean blob that stores condition
28 value. Accepts 'then_net' (required) and 'else_net' (optional) arguments for 'then' and
29 'else' subnets respectively. Subnets are executed in the same workspace as 'If'.
30  )DOC")
31  .Arg("then_net", "Net executed when condition is true")
32  .Arg("else_net", "Net executed when condition is false (optional)")
33  .Input(0, "condition", "Scalar boolean condition")
34  .AllowInplace([](int in, int out) -> bool { return true; });
35 
36 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.