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

Function BcastAdd

tensorflow/core/kernels/cwise_ops_test.cc:316–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314#undef BM_BIAS_ADD_GRAD
315
316Graph* BcastAdd(int rows, int cols, int dim) {
317 Graph* g = new Graph(OpRegistry::Global());
318 TensorShape lhs_shape, rhs_shape;
319 if (dim == 0) { // row
320 lhs_shape = TensorShape({rows, cols});
321 rhs_shape = TensorShape({rows, 1});
322 } else if (dim == 1) { // col
323 lhs_shape = TensorShape({rows, cols});
324 rhs_shape = TensorShape({cols});
325 } else if (dim == 2) { // cross_rc
326 lhs_shape = TensorShape({rows, 1});
327 rhs_shape = TensorShape({1, cols});
328 } else { // cross_cr
329 lhs_shape = TensorShape({1, cols});
330 rhs_shape = TensorShape({rows, 1});
331 }
332 Tensor lhs(DT_FLOAT, lhs_shape);
333 lhs.flat<float>().setRandom();
334 Tensor rhs(DT_FLOAT, rhs_shape);
335 rhs.flat<float>().setRandom();
336 test::graph::Binary(g, "Add", test::graph::Constant(g, lhs),
337 test::graph::Constant(g, rhs));
338 return g;
339}
340
341#define BM_BCAST_ADD_ROW(DEVICE, R, C) \
342 void BM_##DEVICE##_BcastAddRow_R##R##_C##C(int iters, int arg) { \

Callers

nothing calls this directly

Calls 3

ConstantFunction · 0.70
TensorShapeClass · 0.50
BinaryFunction · 0.50

Tested by

no test coverage detected