Reduce implicit copies in make_array (#874)

1. Move shapes into outputs instead of copying them.
2. Pass primitive by const ref as it is always copied into outputs, which
   removes a copy when calling make_array.
This commit is contained in:
Cheng
2024-03-22 22:29:16 +09:00
committed by GitHub
parent 44390bd3d0
commit f0ae00da12
5 changed files with 18 additions and 14 deletions

View File

@@ -782,7 +782,7 @@ std::function<std::vector<array>(const std::vector<array>&)> custom_vjp(
}
return array::make_arrays(
shapes,
std::move(shapes),
dtypes,
std::make_shared<CustomVJP>(to_stream(s), fun_vjp),
inputs);