MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / operator()

Method operator()

tensorflow/core/kernels/scatter_functor.h:201–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199template <typename Device, typename T, typename Index, scatter_op::UpdateOp op>
200struct ScatterFunctorBase {
201 Index operator()(OpKernelContext* c, const Device& d,
202 typename TTypes<T>::Matrix params,
203 typename TTypes<T>::ConstMatrix updates,
204 typename TTypes<Index>::ConstFlat indices) {
205 // indices and params sizes were validated in DoCompute().
206 const Index N = static_cast<Index>(indices.size());
207 const Index limit = static_cast<Index>(params.dimension(0));
208 for (Index i = 0; i < N; i++) {
209 // Grab the index and check its validity. Do this carefully,
210 // to avoid checking the value and grabbing it again from
211 // memory a second time (a security risk since it may change in between).
212 const Index index = ::tensorflow::internal::SubtleMustCopy(indices(i));
213 if (!FastBoundsCheck(index, limit)) return i;
214 // Copy last Ndim-1 dimensions of updates[i] to params[index]
215 scatter_op::internal::Assign<op>::Run(params.template chip<0>(index),
216 updates.template chip<0>(i));
217 }
218 return -1;
219 }
220};
221
222template <typename Device, typename Index>

Callers

nothing calls this directly

Calls 5

SubtleMustCopyFunction · 0.85
FastBoundsCheckFunction · 0.85
RunFunction · 0.50
sizeMethod · 0.45
dimensionMethod · 0.45

Tested by

no test coverage detected