| 185 | |
| 186 | private: |
| 187 | void Compute(user_op::KernelComputeContext* ctx) const override { |
| 188 | const user_op::Tensor* start = ctx->Tensor4ArgNameAndIndex("start", 0); |
| 189 | const user_op::Tensor* end = ctx->Tensor4ArgNameAndIndex("end", 0); |
| 190 | const user_op::Tensor* out_diff = ctx->Tensor4ArgNameAndIndex("out_diff", 0); |
| 191 | user_op::Tensor* start_diff = ctx->Tensor4ArgNameAndIndex("start_diff", 0); |
| 192 | user_op::Tensor* end_diff = ctx->Tensor4ArgNameAndIndex("end_diff", 0); |
| 193 | |
| 194 | const ShapeView& start_shape = start->shape_view(); |
| 195 | const ShapeView& end_shape = end->shape_view(); |
| 196 | CHECK_EQ(start_shape, end_shape); |
| 197 | |
| 198 | const T* start_ptr = start->dptr<T>(); |
| 199 | const T* end_ptr = end->dptr<T>(); |
| 200 | const T* out_diff_ptr = out_diff->dptr<T>(); |
| 201 | T* start_diff_ptr = start_diff->mut_dptr<T>(); |
| 202 | T* end_diff_ptr = end_diff->mut_dptr<T>(); |
| 203 | |
| 204 | Scalar scalar_operand; |
| 205 | if (ctx->Attr<bool>("has_int_operand")) { |
| 206 | scalar_operand = ctx->Attr<int64_t>("int_operand"); |
| 207 | } else if (ctx->Attr<bool>("has_float_operand")) { |
| 208 | scalar_operand = ctx->Attr<double>("float_operand"); |
| 209 | } else { |
| 210 | UNIMPLEMENTED(); |
| 211 | } |
| 212 | |
| 213 | ScalarLerpKernelUtil<device_type, T, ValueT>::Backward( |
| 214 | ctx->stream(), start_shape.elem_cnt(), start_ptr, end_ptr, out_diff_ptr, scalar_operand, |
| 215 | start_diff_ptr, end_diff_ptr); |
| 216 | } |
| 217 | bool AlwaysComputeWhenAllOutputsEmpty() const override { return false; } |
| 218 | }; |
| 219 |
nothing calls this directly
no test coverage detected