Skip to content

Commit 906cbe3

Browse files
authored
support string dtype input generation (#8003)
FEATURE
1 parent 6b539e8 commit 906cbe3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

e2e/benchmarks/benchmark_util.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ function generateInputFromDef(inputDefs, isForGraphModel = false) {
107107
// the data generated maybe outside of [min, max].
108108
inputTensor = tf.clipByValue(generatedRaw, min, max);
109109
generatedRaw.dispose();
110+
} else if (inputDef.dtype === 'string') {
111+
size = tf.util.sizeFromShape(inputDef.shape);
112+
data = [...Array(size)].map(
113+
() => Math.random().toString(36).substring(2, 7));
114+
inputTensor = tf.tensor(data, inputShape, inputDef.dtype);
110115
} else {
111116
throw new Error(
112117
`The ${inputDef.dtype} dtype of '${inputDef.name}' input ` +

0 commit comments

Comments
 (0)