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

feat: Client-side input shape/element validation #742

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/python/library/tritonclient/grpc/_infer_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from tritonclient.grpc import service_pb2
from tritonclient.utils import *

from ._utils import get_data_type_byte_size, num_elements, raise_error
from ._utils import num_elements, raise_error
rmccorm4 marked this conversation as resolved.
Show resolved Hide resolved


class InferInput:
Expand Down
1 change: 0 additions & 1 deletion src/python/library/tritonclient/http/_infer_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import numpy as np
from tritonclient.utils import (
get_data_type_byte_size,
np_to_triton_dtype,
num_elements,
raise_error,
Expand Down
48 changes: 0 additions & 48 deletions src/python/library/tritonclient/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,54 +211,6 @@ def triton_to_np_dtype(dtype):
return None


def get_data_type_byte_size(dtype):
"""
Get the size of a given datatype in bytes.

Parameters
----------
dtype : str
The data-type

Returns
-------
int
The size in bytes of the datatype, or 0 if size cannot be determined
(for example, values of type BYTES have variable length and so size
cannot be determine just from the type)
"""

if dtype == "BOOL":
return 1
elif dtype == "INT8":
return 1
elif dtype == "INT16":
return 2
elif dtype == "INT32":
return 4
elif dtype == "INT64":
return 8
elif dtype == "UINT8":
return 1
elif dtype == "UINT16":
return 2
elif dtype == "UINT32":
return 4
elif dtype == "UINT64":
return 8
elif dtype == "FP16":
return 2
elif dtype == "FP32":
return 4
elif dtype == "FP64":
return 8
elif dtype == "BYTES":
return 0
elif dtype == "BF16":
return 2
return 0


def serialize_byte_tensor(input_tensor):
"""
Serializes a bytes tensor into a flat numpy array of length prepended
Expand Down
Loading