1 #include "caffe2/operators/log_op.h" 10 UnaryElementwiseOp<TensorTypes<float>, CPUContext, LogFunctor<CPUContext>>);
15 .AllowInplace({{0, 0}})
16 .IdenticalTypeAndShape()
18 Calculates the natural log of the given input tensor ($ln(x)$), element-wise. This 19 operation can be done in an in-place fashion too, by providing the same input 23 - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/log_op.cc 27 <summary> <b>Example</b> </summary> 33 workspace.ResetWorkspace() 35 op = core.CreateOperator( 41 workspace.FeedBlob("X", (np.random.rand(3,3)).astype(np.float32)) 42 print("X before running op:", workspace.FetchBlob("X")) 43 workspace.RunOperatorOnce(op) 44 print("X after running op:", workspace.FetchBlob("X")) 53 [[0.07341351 0.15404125 0.386613 ] 54 [0.34090295 0.99727786 0.24141751] 55 [0.32016268 0.8724168 0.93515724]] 57 [[-2.6116474 -1.8705349 -0.9503311 ] 58 [-1.0761575 -0.00272586 -1.4212275 ] 59 [-1.138926 -0.13648799 -0.06704059]] 66 .Input(0, "X",
"*(type: Tensor`<float>`)* Input tensor.")
70 "*(type: Tensor`<float>`)* Output tensor computed as the natural log of the input tensor computed, element-wise.")
76 using GradientMakerBase::GradientMakerBase;
77 std::vector<OperatorDef> GetGradientDefs()
override {
78 return SingleGradientDef(
81 std::vector<std::string>{GO(0), I(0)},
82 std::vector<std::string>{GI(0)});
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...