From eeb99333684c69d32d15c25a4523b283095d5a98 Mon Sep 17 00:00:00 2001 From: Ping Yu <4018+pyu10055@users.noreply.github.com> Date: Fri, 13 Oct 2023 14:46:16 -0700 Subject: [PATCH] support string dtype input generation --- e2e/benchmarks/benchmark_util.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/e2e/benchmarks/benchmark_util.js b/e2e/benchmarks/benchmark_util.js index 414489d780b..d6a9d249d56 100644 --- a/e2e/benchmarks/benchmark_util.js +++ b/e2e/benchmarks/benchmark_util.js @@ -107,6 +107,11 @@ function generateInputFromDef(inputDefs, isForGraphModel = false) { // the data generated maybe outside of [min, max]. inputTensor = tf.clipByValue(generatedRaw, min, max); generatedRaw.dispose(); + } else if (inputDef.dtype === 'string') { + size = tf.util.sizeFromShape(inputDef.shape); + data = [...Array(size)].map( + () => Math.random().toString(36).substring(2, 7)); + inputTensor = tf.tensor(data, inputShape, inputDef.dtype); } else { throw new Error( `The ${inputDef.dtype} dtype of '${inputDef.name}' input ` +