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

Function ConcatHelper

tensorflow/core/kernels/quantized_concat_op_test.cc:251–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249// quantized range; otherwise, they are set to different values.
250template <typename T>
251static 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
288static void BM_QConcatDim0SameLimitQInt32(int iters, int dim2) {
289 ConcatHelper<qint32>(iters, 0 /* concat_dimension */, true /* same_limits */,

Callers

nothing calls this directly

Calls 12

StopTimingFunction · 0.85
BytesProcessedFunction · 0.85
StartTimingFunction · 0.85
UseRealTimeFunction · 0.85
ConstantFunction · 0.70
NodeBuilderClass · 0.50
BenchmarkClass · 0.50
FinalizeMethod · 0.45
AttrMethod · 0.45
InputMethod · 0.45
NewNameMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected