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

Function ValidShapes

tensorflow/core/kernels/scatter_op.cc:39–54  ·  view source on GitHub ↗

Check whether updates.shape = indices.shape + params.shape[1:]

Source from the content-addressed store, hash-verified

37
38// Check whether updates.shape = indices.shape + params.shape[1:]
39static bool ValidShapes(const Tensor& params, const Tensor& updates,
40 const Tensor& indices) {
41 if (updates.dims() == 0) return true;
42 if (updates.dims() != indices.dims() + params.dims() - 1) return false;
43 for (int d = 0; d < indices.dims(); d++) {
44 if (updates.dim_size(d) != indices.dim_size(d)) {
45 return false;
46 }
47 }
48 for (int d = 1; d < params.dims(); d++) {
49 if (params.dim_size(d) != updates.dim_size(d - 1 + indices.dims())) {
50 return false;
51 }
52 }
53 return true;
54}
55
56static void DoValidationChecking(OpKernelContext* c, const Tensor& params,
57 const Tensor& indices, const Tensor& updates) {

Callers 1

DoValidationCheckingFunction · 0.85

Calls 2

dimsMethod · 0.45
dim_sizeMethod · 0.45

Tested by

no test coverage detected