Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transpose slower than numpy #2784

Open
wlz987 opened this issue May 12, 2024 · 0 comments
Open

transpose slower than numpy #2784

wlz987 opened this issue May 12, 2024 · 0 comments

Comments

@wlz987
Copy link

wlz987 commented May 12, 2024

xt::xtensor<float, 3> img_array_trans = xt::cast<float>(xt::transpose(img_array, {2, 0, 1})) / 255.0f;

slower than

n_arrary = np.transpose(n_arrary.astype(
np.float32) / 255.0, (2, 0, 1)) # 浅拷贝
n_arrary = np.ascontiguousarray(n_arrary) # 深拷贝

CC = g++
CFLAGS = -Wall -std=c++14 -O3 -march=native -mavx2 -ffast-math -funroll-loops -pthread -flto -malign-double

XTENSOR_FLAGS = -DXTENSOR_USE_XSIMD -DNDEBUG

XTL_PATH = /home/lhx/software/raw_code/xtl
XTENSOR_PATH = /home/lhx/software/raw_code/xtensor
XSIMD_PATH = /home/lhx/software/raw_code/xsimd

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

No branches or pull requests

1 participant