| 188 | } |
| 189 | |
| 190 | void Run(const TCudaStream& stream, TKernelContext& context) { |
| 191 | if (FunctionValue.Size()) { |
| 192 | NKernel::FillBuffer(FunctionValue.Get(), 0.0f, 1, stream.GetStream()); |
| 193 | } |
| 194 | if (Predictions.Size() == 0) { |
| 195 | return; |
| 196 | } |
| 197 | |
| 198 | if (Der.Size()) { |
| 199 | CB_ENSURE(Der.Size() == Predictions.Size()); |
| 200 | } |
| 201 | CB_ENSURE(QuerySizes.Size() == QueryOffsets.Size()); |
| 202 | if (Indices.Size()) { |
| 203 | CB_ENSURE(Indices.Size() == Predictions.Size()); |
| 204 | NKernel::Gather(context.MseDer.Get(), Predictions.Get(), Indices.Get(), Indices.Size(), stream.GetStream()); |
| 205 | } else { |
| 206 | CopyMemoryAsync(Predictions.Get(), context.MseDer.Get(), Predictions.Size(), stream); |
| 207 | } |
| 208 | |
| 209 | NKernel::MultiplyVector(context.MseDer.Get(), -1.0f, Predictions.Size(), stream.GetStream()); |
| 210 | NKernel::AddVector(context.MseDer.Get(), Relevs.Get(), Relevs.Size(), stream.GetStream()); |
| 211 | NKernel::ComputeGroupMeans(context.MseDer.Get(), Weights.Get(), QueryOffsets.Get(), QueryOffsetsBias, |
| 212 | QuerySizes.Get(), QueryOffsets.Size(), context.QueryMeans, |
| 213 | stream.GetStream()); |
| 214 | NKernel::ComputeGroupIds(QuerySizes.Get(), QueryOffsets.Get(), QueryOffsetsBias, QueryOffsets.Size(), |
| 215 | context.Qids, stream.GetStream()); |
| 216 | NKernel::ApproximateQueryRmse(context.MseDer.Get(), |
| 217 | Weights.Get(), |
| 218 | context.Qids, |
| 219 | static_cast<ui32>(Predictions.Size()), |
| 220 | context.QueryMeans, |
| 221 | Indices.Get(), |
| 222 | FunctionValue.Get(), |
| 223 | Der.Get(), |
| 224 | Der2.Get(), |
| 225 | stream.GetStream()); |
| 226 | } |
| 227 | }; |
| 228 | |
| 229 | class TQuerySoftMaxKernel: public TKernelBase<NKernel::TQuerySoftMaxContext, false> { |
nothing calls this directly
no test coverage detected