Skip to content

Conversation

@hbwx24
Copy link
Contributor

@hbwx24 hbwx24 commented Jul 16, 2021

PR types

Function optimization

PR changes

OPs

Describe

strided_slice:当step<0时,没有与numpy对齐。

import numpy as np
import paddle


array = np.arange(5)


pt = paddle.to_tensor(array)

sl = paddle.strided_slice(pt, axes=[0, ], starts=[3, ], ends=[1, ], strides=[-2, ])
print("array:", array)
print("numpy:", array[3:1:-2])
print("paddle:", sl)

# 输出
# array: [0 1 2 3 4]
# numpy: [3]
# paddle: Tensor(shape=[1], dtype=int64, place=CPUPlace, stop_gradient=True, [2])

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@TeslaZhao TeslaZhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hbwx24 hbwx24 merged commit 7f2b5be into PaddlePaddle:develop Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants