mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Remove unnecessary string copies (#891)
1. Use string_view instead of string when there is no need for copy. 2. Otherwise move string when possible.
This commit is contained in:
@@ -96,7 +96,7 @@ inline array matrix_norm(
|
||||
|
||||
inline array matrix_norm(
|
||||
const array& a,
|
||||
const std::string& ord,
|
||||
std::string_view ord,
|
||||
const std::vector<int>& axis,
|
||||
bool keepdims,
|
||||
StreamOrDevice s) {
|
||||
@@ -153,7 +153,7 @@ array norm(
|
||||
|
||||
array norm(
|
||||
const array& a,
|
||||
const std::string& ord,
|
||||
std::string_view ord,
|
||||
const std::optional<std::vector<int>>& axis /* = std::nullopt */,
|
||||
bool keepdims /* = false */,
|
||||
StreamOrDevice s /* = {} */) {
|
||||
|
||||
Reference in New Issue
Block a user