1 #include "caffe2/operators/sqrt_op.h" 13 SqrtFunctor<CPUContext>>);
19 .AllowInplace({{0, 0}})
20 .IdenticalTypeAndShape()
22 Performs element-wise square-root ($\sqrt{x}$) of input tensor $X$. 25 - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/sqrt_op.cc 29 <summary> <b>Example</b> </summary> 35 workspace.ResetWorkspace() 37 op = core.CreateOperator( 43 workspace.FeedBlob("X", (np.random.randint(10, size=(3,3))).astype(np.float32)) 44 print("X:", workspace.FetchBlob("X")) 45 workspace.RunOperatorOnce(op) 46 print("Y:", workspace.FetchBlob("Y")) 59 [[2.8284268 1.7320508 1.7320508 ] 61 [0.99999994 1.4142134 2.236068 ]] 67 .Input(0, "X",
"*(type: Tensor`<float>`)* Input data tensor.")
68 .Output(0,
"Y",
"*(type: Tensor`<float>`)* Output tensor.");
73 using GradientMakerBase::GradientMakerBase;
74 std::vector<OperatorDef> GetGradientDefs()
override {
76 scale_arg.set_name(
"scale");
78 return std::vector<OperatorDef>{CreateOperatorDef(
81 std::vector<std::string>{GO(0)},
82 std::vector<std::string>{GI(0)},
83 std::vector<Argument>{scale_arg}),
87 std::vector<std::string>{GI(0), O(0)},
88 std::vector<std::string>{GI(0)})};
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...