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

Replace flatten with ravel to avoid unnecessary time cost of data copy #376

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def set_shared_memory_region(cuda_shm_handle, input_values):

offset_current = 0
for input_value in input_values:
input_value = np.ascontiguousarray(input_value).flatten()
input_value = np.ascontiguousarray(input_value).ravel()
# When the input array is in type "BYTES" (np.object_ is
# the numpy equivalent), expect the array has been serialized
# via 'tritonclient.utils.serialize_byte_tensor'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def set_shared_memory_region(shm_handle, input_values, offset=0):

offset_current = offset
for input_value in input_values:
input_value = np.ascontiguousarray(input_value).flatten()
input_value = np.ascontiguousarray(input_value).ravel()
if input_value.dtype == np.object_:
input_value = input_value.item()
byte_size = np.dtype(np.byte).itemsize * len(input_value)
Expand Down