| 249 | // quantized range; otherwise, they are set to different values. |
| 250 | template <typename T> |
| 251 | static void ConcatHelper(int iters, int concat_dimension, bool same_limits, |
| 252 | int dim2) { |
| 253 | testing::StopTiming(); |
| 254 | Graph* g = new Graph(OpRegistry::Global()); |
| 255 | |
| 256 | DataType dt = DataTypeToEnum<T>::v(); |
| 257 | const int kDim1 = 100; |
| 258 | TensorShape shape({kDim1, dim2}); |
| 259 | |
| 260 | Tensor concat_dim = test::AsScalar<int32>(concat_dimension); |
| 261 | Tensor in0(dt, shape); |
| 262 | in0.flat<T>().setRandom(); |
| 263 | Tensor in1(dt, shape); |
| 264 | in1.flat<T>().setRandom(); |
| 265 | |
| 266 | Tensor mins0 = test::AsScalar<float>(-1.0); |
| 267 | Tensor maxes0 = test::AsScalar<float>(1.0); |
| 268 | Tensor mins1 = test::AsScalar<float>(same_limits ? -1.0 : -255.0); |
| 269 | Tensor maxes1 = test::AsScalar<float>(same_limits ? 1.0 : 255.0); |
| 270 | |
| 271 | Node* node; |
| 272 | TF_CHECK_OK(NodeBuilder(g->NewName("n"), "QuantizedConcat") |
| 273 | .Input(Constant(g, concat_dim)) |
| 274 | .Input({Constant(g, in0), Constant(g, in1)}) |
| 275 | .Input({Constant(g, mins0), Constant(g, mins1)}) |
| 276 | .Input({Constant(g, maxes0), Constant(g, maxes1)}) |
| 277 | .Attr("N", 2) |
| 278 | .Attr("T", dt) |
| 279 | .Finalize(g, &node)); |
| 280 | |
| 281 | testing::BytesProcessed(static_cast<int64>(iters) * |
| 282 | ((kDim1 * dim2) + (kDim1 * dim2)) * sizeof(T)); |
| 283 | testing::StartTiming(); |
| 284 | test::Benchmark("cpu", g).Run(iters); |
| 285 | testing::UseRealTime(); |
| 286 | } |
| 287 | |
| 288 | static void BM_QConcatDim0SameLimitQInt32(int iters, int dim2) { |
| 289 | ConcatHelper<qint32>(iters, 0 /* concat_dimension */, true /* same_limits */, |
nothing calls this directly
no test coverage detected