Skip to content

Commit

Permalink
Change the type of padding input to array
Browse files Browse the repository at this point in the history
fix #224
  • Loading branch information
huningxin committed Nov 24, 2021
1 parent aaddda1 commit 379149e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1563,13 +1563,14 @@ dictionary MLPadOptions {
};

partial interface MLGraphBuilder {
MLOperand pad(MLOperand input, MLOperand padding, optional MLPadOptions options = {});
MLOperand pad(MLOperand input, sequence<sequence<long>> padding,
optional MLPadOptions options = {});
};
</script>
<div algorithm=pad>
**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.
Expand All @@ -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],
Expand Down

0 comments on commit 379149e

Please sign in to comment.