1 #include "caffe2/operators/minmax_ops.h" 5 REGISTER_CPU_OPERATOR(Min, MinOp<float, CPUContext>);
6 REGISTER_CPU_OPERATOR(Max, MaxOp<float, CPUContext>);
11 .IdenticalTypeAndShapeOfInput(0)
12 .AllowInplace({{0, 0}})
14 Element-wise max of an arbitrary number of input tensors. This operation can be 15 performed in-place, by using the first input blob as the output blob. All inputs 16 must have the same shape and data type, and the output will have the same shape 20 - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/minmax_ops.cc 24 <summary> <b>Example</b> </summary> 30 workspace.ResetWorkspace() 32 op = core.CreateOperator( 38 workspace.FeedBlob("X", (np.random.rand(3,3)).astype(np.float32)) 39 workspace.FeedBlob("Y", (np.random.rand(3,3)).astype(np.float32)) 40 workspace.FeedBlob("Z", (np.random.rand(3,3)).astype(np.float32)) 41 print("X:", workspace.FetchBlob("X")) 42 print("Y:", workspace.FetchBlob("Y")) 43 print("Z:", workspace.FetchBlob("Z")) 44 workspace.RunOperatorOnce(op) 45 print("Max:", workspace.FetchBlob("X")) 54 [[0.4496477 0.07061381 0.7139333 ] 55 [0.83203 0.05970785 0.72786295] 56 [0.75988126 0.04601283 0.32820013]] 58 [[0.05683139 0.16872478 0.671098 ] 59 [0.70739156 0.09878621 0.03416285] 60 [0.34087983 0.94986707 0.67263436]] 62 [[0.48051122 0.07141234 0.85264146] 63 [0.77086854 0.22082241 0.13154659] 64 [0.42401117 0.995431 0.4263775 ]] 66 [[0.48051122 0.16872478 0.85264146] 67 [0.83203 0.22082241 0.72786295] 68 [0.75988126 0.995431 0.67263436]] 78 "*(type: Tensor`<Ord>`)* List of input tensors with the same shape.")
82 "*(type: Tensor`<Ord>`)* Output tensor with same dimensions as input(s)." 83 "Contains the maximum valued element at each location.")
87 .NumInputs(1, INT_MAX)
89 .IdenticalTypeAndShapeOfInput(0)
90 .AllowInplace({{0, 0}})
92 Element-wise min of an arbitrary number of input tensors. This operation can be performed in-place, by using the first input blob as the output blob. All inputs must have the same shape and data type, and the output will have the same shape as the inputs. 95 - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/minmax_ops.cc 99 <summary> <b>Example</b> </summary> 105 workspace.ResetWorkspace() 107 op = core.CreateOperator( 113 workspace.FeedBlob("X", (np.random.rand(2,2)).astype(np.float32)) 114 workspace.FeedBlob("Y", (np.random.rand(2,2)).astype(np.float32)) 115 workspace.FeedBlob("Z", (np.random.rand(2,2)).astype(np.float32)) 116 print("X:", workspace.FetchBlob("X")) 117 print("Y:", workspace.FetchBlob("Y")) 118 print("Z:", workspace.FetchBlob("Z")) 119 workspace.RunOperatorOnce(op) 120 print("Min:", workspace.FetchBlob("X")) 129 [[0.32731926 0.4939747 ] 130 [0.29242373 0.43460014]] 132 [[0.40928316 0.916115 ] 133 [0.77526504 0.29339448]] 135 [[0.7899794 0.90335774] 136 [0.82599413 0.2843068 ]] 138 [[0.32731926 0.4939747 ] 139 [0.29242373 0.2843068 ]] 149 "*(type: Tensor`<Ord>`)* List of input tensors with the same shape.")
153 "*(type: Tensor`<Ord>`)* Output tensor with same dimensions as input(s)." 154 "Contains the minimum valued element at each location.")
155 .InheritOnnxSchema();
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...