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

Function GetBroadcastSize

tensorflow/core/framework/ops_util.cc:40–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40Status GetBroadcastSize(const int index, const int in_size, const int ksize,
41 const int stride, const int pad_size, int* bindex,
42 int* bsize) {
43 // Cannot have index beyond the input size.
44 if (index * stride > in_size) {
45 return errors::InvalidArgument(
46 "index * stride must be less than or equal to input size");
47 }
48 *bindex = index * stride;
49 *bsize = ksize;
50 if (*bindex < pad_size) {
51 // If the current index is in the padding area, start broadcast from index
52 // 0 with broadcast size reduced by padding size.
53 *bsize = ksize + *bindex - pad_size;
54 *bindex = 0;
55 } else {
56 // Otherwise, start broadcast from current index reduced by padding size.
57 *bindex -= pad_size;
58 }
59 if (*bindex + ksize > in_size) {
60 *bsize = std::min((in_size - *bindex), ksize);
61 }
62 return Status::OK();
63}
64
65string SanitizeThreadSuffix(string suffix) {
66 string clean;

Callers 5

VerifyBoundariesMethod · 0.85
VerifyBcastValuesMethod · 0.85
ComputeMethod · 0.85
launchMethod · 0.85
launchMethod · 0.85

Calls 2

InvalidArgumentFunction · 0.85
minFunction · 0.50

Tested by 2

VerifyBoundariesMethod · 0.68
VerifyBcastValuesMethod · 0.68