From 379149e77a7133903f74f85d71a0d376f2a444c6 Mon Sep 17 00:00:00 2001 From: Ningxin Hu Date: Tue, 23 Nov 2021 16:02:08 +0800 Subject: [PATCH] Change the type of padding input to array fix #224 --- index.bs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.bs b/index.bs index 68a537e1..21db013b 100644 --- a/index.bs +++ b/index.bs @@ -1563,13 +1563,14 @@ dictionary MLPadOptions { }; partial interface MLGraphBuilder { - MLOperand pad(MLOperand input, MLOperand padding, optional MLPadOptions options = {}); + MLOperand pad(MLOperand input, sequence> padding, + optional MLPadOptions options = {}); };
**Arguments:** - *input*: an {{MLOperand}}. The input tensor. - - *padding*: an {{MLOperand}}. The 2-D Tensor of integer values indicating the number of padding values to add at the beginning and end of each input dimensions. The tensor has shape [*n*, 2] where *n* is the rank of the input tensor. For each dimension *D* of *input*, *padding[D, 0]* indicates how many values to add before the content in that dimension, and *padding[D, 1]* indicates how many values to add after the content in that dimension. + - *padding*: a sequence of length 2, where each element is a sequence of {{long}} whose length is equal to the rank of the input tensor. The integer values indicating the number of padding values to add at the beginning and end of each input dimensions. For each dimension *D* of *input*, *padding[D, 0]* indicates how many values to add before the content in that dimension, and *padding[D, 1]* indicates how many values to add after the content in that dimension. - *options*: an optional {{MLPadOptions}}. The optional parameters of the operation. - *mode*: a {{MLPaddingMode}}. The different ways to pad the tensor. When not set, it's assumed to be "constant". - *value*: a {{float}}. The pad value when the *options.mode* is set to *"constant"*. When not set, it's assumed to be 0. @@ -1582,8 +1583,7 @@ partial interface MLGraphBuilder { { type: 'float32', dimensions: [2,3] }, new Float32Array([1,2,3,4,5,6])); // padding: [[1,1], [2,2]] - const padding = builder.constant( - { type: 'float32', dimensions: [2,2] }, new Float32Array([1,1,2,2])); + const padding = [[1,1], [2,2]]; // "constant" padded: // [[0,0,0,0,0,0,0],