| 77 | |
| 78 | private: |
| 79 | void Compute(user_op::KernelComputeContext* ctx) const override { |
| 80 | const user_op::Tensor* start = ctx->Tensor4ArgNameAndIndex("start", 0); |
| 81 | const user_op::Tensor* end = ctx->Tensor4ArgNameAndIndex("end", 0); |
| 82 | const user_op::Tensor* weight = ctx->Tensor4ArgNameAndIndex("weight", 0); |
| 83 | const user_op::Tensor* out_diff = ctx->Tensor4ArgNameAndIndex("out_diff", 0); |
| 84 | user_op::Tensor* start_diff = ctx->Tensor4ArgNameAndIndex("start_diff", 0); |
| 85 | user_op::Tensor* end_diff = ctx->Tensor4ArgNameAndIndex("end_diff", 0); |
| 86 | user_op::Tensor* weight_diff = ctx->Tensor4ArgNameAndIndex("weight_diff", 0); |
| 87 | |
| 88 | const ShapeView& start_shape = start->shape_view(); |
| 89 | const ShapeView& end_shape = end->shape_view(); |
| 90 | const ShapeView& weight_shape = weight->shape_view(); |
| 91 | CHECK_EQ(start_shape, end_shape); |
| 92 | CHECK_EQ(start_shape, weight_shape); |
| 93 | |
| 94 | const T* start_ptr = start->dptr<T>(); |
| 95 | const T* end_ptr = end->dptr<T>(); |
| 96 | const T* weight_ptr = weight->dptr<T>(); |
| 97 | const T* out_diff_ptr = out_diff->dptr<T>(); |
| 98 | T* start_diff_ptr = start_diff->mut_dptr<T>(); |
| 99 | T* end_diff_ptr = end_diff->mut_dptr<T>(); |
| 100 | T* weight_diff_ptr = weight_diff->mut_dptr<T>(); |
| 101 | |
| 102 | LerpKernelUtil<device_type, T>::Backward(ctx->stream(), start_shape.elem_cnt(), start_ptr, |
| 103 | weight_ptr, end_ptr, out_diff_ptr, start_diff_ptr, |
| 104 | weight_diff_ptr, end_diff_ptr); |
| 105 | } |
| 106 | bool AlwaysComputeWhenAllOutputsEmpty() const override { return false; } |
| 107 | }; |
| 108 |
nothing calls this directly
no test coverage detected