Skip to content

Commit 7a7b869

Browse files
authored
Fix type boolean (triton-inference-server#35)
1 parent 75a8af8 commit 7a7b869

3 files changed

Lines changed: 10 additions & 14 deletions

File tree

src/python.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ class ModelInstanceState : public BackendModelInstance {
135135
private:
136136
TRITONBACKEND_Model* triton_model_;
137137
pid_t interpreter_pid_;
138-
std::vector<BackendMemory*> input_tensor_memories_;
139138
};
140139

141140
class ModelState : public BackendModel {
@@ -333,12 +332,6 @@ ModelInstanceState::~ModelInstanceState()
333332
}
334333
}
335334

336-
// Remove input tensor memories
337-
for (BackendMemory* mem : input_tensor_memories_) {
338-
delete mem;
339-
}
340-
input_tensor_memories_.clear();
341-
342335
stub.reset();
343336

344337
int status;

src/resources/startup.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
import numpy as np
4545

4646
from python_host_pb2 import *
47-
from python_host_pb2_grpc import PythonInterpreterServicer, add_PythonInterpreterServicer_to_server
47+
from python_host_pb2_grpc import \
48+
PythonInterpreterServicer, add_PythonInterpreterServicer_to_server
4849
import grpc
4950

5051
MAX_GRPC_MESSAGE_SIZE = 2147483647
@@ -72,9 +73,9 @@ def serialize_byte_tensor(input_tensor):
7273
if input_tensor.size == 0:
7374
return np.empty([0])
7475

75-
# If the input is a tensor of string/bytes objects, then must flatten those into
76-
# a 1-dimensional array containing the 4-byte byte size followed by the
77-
# actual element bytes. All elements are concatenated together in "C"
76+
# If the input is a tensor of string/bytes objects, then must flatten those
77+
# into a 1-dimensional array containing the 4-byte byte size followed by
78+
# the actual element bytes. All elements are concatenated together in "C"
7879
# order.
7980
if (input_tensor.dtype == np.object) or (input_tensor.dtype.type
8081
== np.bytes_):
@@ -153,7 +154,9 @@ def __init__(self, module_path, *args, **kwargs):
153154
super(PythonInterpreterServicer, self).__init__(*args, **kwargs)
154155

155156
module_path = Path(module_path).resolve()
156-
# Add model parent directories so that relative and absolute import work
157+
158+
# Add model parent directories so that relative and absolute imports
159+
# work.
157160
sys.path.append(str(module_path.parent))
158161
sys.path.append(str(module_path.parent.parent))
159162

@@ -190,7 +193,7 @@ def Init(self, request, context):
190193
args = {x.key: x.value for x in request.args}
191194
try:
192195
self.model_instance.initialize(args)
193-
except Exception as e:
196+
except Exception:
194197
context.set_code(grpc.StatusCode.INTERNAL)
195198
tb = traceback.format_exc()
196199
context.set_details(tb)

src/resources/triton_python_backend_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
TRITON_TO_NUMPY_TYPE = {
3030
# TRITONSERVER_TYPE_BOOL
31-
1: np.bool,
31+
1: np.bool_,
3232
# TRITONSERVER_TYPE_UINT8
3333
2: np.uint8,
3434
# TRITONSERVER_TYPE_UINT16

0 commit comments

Comments
 (0)