Skip to content

Commit

Permalink
Define Pad API
Browse files Browse the repository at this point in the history
  • Loading branch information
TakuyaNarihira committed Apr 27, 2018
1 parent e4b2851 commit ccd79e9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build-tools/code_generator/function_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ Stack:
Slice:
float: [float]
half: [Half]
Pad:
float: [float]
half: [Half]
Transpose:
float: [float]
half: [Half]
Expand Down
24 changes: 24 additions & 0 deletions build-tools/code_generator/functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,30 @@ Array Manipulation:
outputs:
y:
doc: Sliced N-D array
Pad:
snake_name: pad
doc: |2
Pad arrays with specified sizes for dimensions.
inputs:
x:
doc: N-D array
arguments:
pad_width:
doc: "A tuple of a repeation of 2 consecutive integers composed of padding sizes of after and before edges at each dimension of an input array. The padding dimensions are aligned to the last dimension of the input array. When ``pad_width=(b0, a0, b1, a1)`` and an input ``xx`` with a shape of ``(s0, s1, s2, s3)`` are given, the output ``y`` becomes ``(s0, s1, b0+s2+a0, b1+s3+a1)``."
type: repeated int64
default: (0,) * len(x.shape)
mode:
doc: "Padding mode is one of the following. 1) ``constant`` : elements in pad region are filled with ``constant_value``, 2) ``reflect`` : TODO, 3) ``replicate`` : padded elements are filled with the values in nearest edges."
type: string
default: '''constant'''
constant_value:
doc: Constant values filled in padded regions if mode is ``constant``.
type: float
default: 0
outputs:
y:
doc: Padded N-D array
Transpose:
snake_name: transpose
doc: |2
Expand Down
1 change: 1 addition & 0 deletions doc/python/api/function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Array Manipulation
.. autofunction:: split
.. autofunction:: stack
.. autofunction:: slice
.. autofunction:: pad
.. autofunction:: transpose
.. autofunction:: broadcast
.. autofunction:: flip
Expand Down

0 comments on commit ccd79e9

Please sign in to comment.