|
35 | 35 |
|
36 | 36 |
|
37 | 37 | class TFParameterTest(tu.TestResultCollector):
|
| 38 | + |
38 | 39 | def setUp(self):
|
39 |
| - self._client = tritonhttpclient.InferenceServerClient("localhost:8000", verbose=True) |
| 40 | + self._client = tritonhttpclient.InferenceServerClient("localhost:8000", |
| 41 | + verbose=True) |
40 | 42 |
|
41 | 43 | def _infer_helper(self):
|
42 |
| - # The model has a single variable which is added to the input. Since the |
43 |
| - # variable is initialized to zero the input and output must match. |
44 |
| - model_name = 'graphdef_variable' |
45 |
| - input = np.array([10], dtype=np.int32) |
| 44 | + # The model has a single variable which is added to the input. Since the |
| 45 | + # variable is initialized to zero the input and output must match. |
| 46 | + model_name = 'graphdef_variable' |
| 47 | + input = np.array([10], dtype=np.int32) |
46 | 48 |
|
47 |
| - inputs = [] |
48 |
| - inputs.append(tritonhttpclient.InferInput('INPUT', input.shape, 'INT32')) |
49 |
| - inputs[-1].set_data_from_numpy(input) |
| 49 | + inputs = [] |
| 50 | + inputs.append(tritonhttpclient.InferInput('INPUT', input.shape, |
| 51 | + 'INT32')) |
| 52 | + inputs[-1].set_data_from_numpy(input) |
50 | 53 |
|
51 |
| - outputs = [] |
52 |
| - outputs.append(tritonhttpclient.InferRequestedOutput('OUTPUT')) |
| 54 | + outputs = [] |
| 55 | + outputs.append(tritonhttpclient.InferRequestedOutput('OUTPUT')) |
53 | 56 |
|
54 |
| - results = self._client.infer(model_name=model_name, inputs=inputs, outputs=outputs) |
55 |
| - output = results.as_numpy('OUTPUT') |
56 |
| - np.testing.assert_array_equal(output, input) |
| 57 | + results = self._client.infer(model_name=model_name, |
| 58 | + inputs=inputs, |
| 59 | + outputs=outputs) |
| 60 | + output = results.as_numpy('OUTPUT') |
| 61 | + np.testing.assert_array_equal(output, input) |
57 | 62 |
|
58 | 63 | def test_tf_variable(self):
|
59 |
| - self._infer_helper() |
| 64 | + self._infer_helper() |
60 | 65 |
|
61 | 66 | def test_tf_variable_error(self):
|
62 |
| - with self.assertRaises(tritonclient.utils.InferenceServerException) as e: |
63 |
| - self._infer_helper() |
64 |
| - self.assertIn("Attempting to use uninitialized value VARIABLE", e.exception.message()) |
| 67 | + with self.assertRaises( |
| 68 | + tritonclient.utils.InferenceServerException) as e: |
| 69 | + self._infer_helper() |
| 70 | + self.assertIn("Attempting to use uninitialized value VARIABLE", |
| 71 | + e.exception.message()) |
65 | 72 |
|
66 | 73 |
|
67 | 74 | if __name__ == '__main__':
|
|
0 commit comments