Pads the middle dimension of a 3D tensor. Arguments: x: Tensor or variable. padding: Tuple of 2 integers, how many zeros to add at the start and end of dim 1. Returns: A padded 3D tensor.
(x, padding=(1, 1))
| 2982 | |
| 2983 | @keras_export('keras.backend.temporal_padding') |
| 2984 | def temporal_padding(x, padding=(1, 1)): |
| 2985 | """Pads the middle dimension of a 3D tensor. |
| 2986 | |
| 2987 | Arguments: |
| 2988 | x: Tensor or variable. |
| 2989 | padding: Tuple of 2 integers, how many zeros to |
| 2990 | add at the start and end of dim 1. |
| 2991 | |
| 2992 | Returns: |
| 2993 | A padded 3D tensor. |
| 2994 | """ |
| 2995 | assert len(padding) == 2 |
| 2996 | pattern = [[0, 0], [padding[0], padding[1]], [0, 0]] |
| 2997 | return array_ops.pad(x, pattern) |
| 2998 | |
| 2999 | |
| 3000 | @keras_export('keras.backend.spatial_2d_padding') |