| 256 | |
| 257 | template <class T> |
| 258 | Graph* BiasAddGrad(int rows, int cols, int channels, DataType type, |
| 259 | TensorFormat format) { |
| 260 | Graph* g = new Graph(OpRegistry::Global()); |
| 261 | TensorShape lhs_shape; |
| 262 | if (format == FORMAT_NCHW) { |
| 263 | lhs_shape = TensorShape({channels, rows, cols}); |
| 264 | } else { |
| 265 | lhs_shape = TensorShape({rows, cols, channels}); |
| 266 | } |
| 267 | Tensor lhs(type, lhs_shape); |
| 268 | lhs.template flat<T>().setRandom(); |
| 269 | Node* n; |
| 270 | TF_CHECK_OK(NodeBuilder(g->NewName("n"), "BiasAddGrad") |
| 271 | .Attr("data_format", ToString(format)) |
| 272 | .Input(test::graph::Constant(g, lhs), /*src_index=*/0) |
| 273 | .Finalize(g, &n)); |
| 274 | return g; |
| 275 | } |
| 276 | |
| 277 | #define BM_BIAS_ADD_GRAD(DEVICE, FMT, C_TYPE, TF_TYPE, R, C, CH) \ |
| 278 | void BM_##DEVICE##_##FMT##_##C_TYPE##_BiasAddGrad_R##R##_C##C##_CH##CH( \ |
nothing calls this directly
no test coverage detected