MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ValidEmptyOutputShape

Function ValidEmptyOutputShape

tensorflow/core/kernels/scatter_nd_op.cc:56–63  ·  view source on GitHub ↗

Returns true if the three tensors have valid number of elements If shape_input has 0 elements, then we need to have indices and updates with exactly 0 elements too, otherwise we should error. If indices has 0 elements then updates should also have 0 elements, otherwise we should error.

Source from the content-addressed store, hash-verified

54// exactly 0 elements too, otherwise we should error. If indices has 0 elements
55// then updates should also have 0 elements, otherwise we should error.
56bool ValidEmptyOutputShape(int64 num_inputs, int64 num_indices,
57 int64 num_updates) {
58 if (num_indices == 0 && num_updates == 0) {
59 return true; // regardless of num_inputs ?= 0, covers both cases
60 }
61 // now we want all 3 tensors to have values
62 return (num_inputs != 0 && num_indices != 0 && num_updates != 0);
63}
64
65template <typename Device, typename T, typename Index>
66class ScatterNdOp : public OpKernel {

Callers 3

ComputeMethod · 0.85
ComputeMethod · 0.85
PrepareAndValidateInputsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected