|
25 | 25 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26 | 26 |
|
27 | 27 | #include <stdint.h>
|
28 |
| - |
29 | 28 | #include <cstdint>
|
30 | 29 | #include <exception>
|
31 | 30 |
|
@@ -506,8 +505,9 @@ class ModelInstanceState : public BackendModelInstance {
|
506 | 505 | const std::string& control_kind, bool required, bool* have_control);
|
507 | 506 | TRITONSERVER_Error* ValidateInputs(const size_t expected_input_cnt);
|
508 | 507 | void AddInputToMap(
|
509 |
| - NamingConvention naming_convention, |
510 |
| - const std::vector<std::string> allowed_inputs, const std::string& io_name, |
| 508 | + NamingConvention naming_convention, |
| 509 | + const std::vector<std::string> allowed_inputs, |
| 510 | + const std::string &io_name, |
511 | 511 | const uint32_t index);
|
512 | 512 | TRITONSERVER_Error* ValidateOutputs();
|
513 | 513 | void Execute(
|
@@ -771,12 +771,7 @@ ModelInstanceState::ValidateTypedSequenceControl(
|
771 | 771 | return nullptr; // success
|
772 | 772 | }
|
773 | 773 |
|
774 |
| -void |
775 |
| -ModelInstanceState::AddInputToMap( |
776 |
| - NamingConvention naming_convention, |
777 |
| - const std::vector<std::string> allowed_inputs, const std::string& io_name, |
778 |
| - const uint32_t index) |
779 |
| -{ |
| 774 | +void ModelInstanceState::AddInputToMap(NamingConvention naming_convention, const std::vector<std::string> allowed_inputs, const std::string &io_name, const uint32_t index) { |
780 | 775 | std::string deliminator = "__";
|
781 | 776 |
|
782 | 777 | if (is_dict_input_) {
|
@@ -929,13 +924,11 @@ ModelInstanceState::ValidateInputs(const size_t expected_input_cnt)
|
929 | 924 | }
|
930 | 925 |
|
931 | 926 | triton::common::TritonJson::Value batch_inputs;
|
932 |
| - RETURN_IF_ERROR( |
933 |
| - model_state_->ModelConfig().MemberAsArray("batch_input", &batch_inputs)); |
| 927 | + RETURN_IF_ERROR(model_state_->ModelConfig().MemberAsArray("batch_input", &batch_inputs)); |
934 | 928 | size_t i = 0;
|
935 | 929 | for (const auto& batch_input : StateForModel()->BatchInputs()) {
|
936 | 930 | for (const auto& input_name : batch_input.TargetNames()) {
|
937 |
| - AddInputToMap( |
938 |
| - naming_convention, allowed_inputs, input_name, i + ios.ArraySize()); |
| 931 | + AddInputToMap(naming_convention, allowed_inputs, input_name, i + ios.ArraySize()); |
939 | 932 | i++;
|
940 | 933 | }
|
941 | 934 | }
|
@@ -1883,16 +1876,12 @@ ModelInstanceState::SetInputTensors(
|
1883 | 1876 | &dst_buffer, &dst_buffer_byte_size, &dst_memory_type,
|
1884 | 1877 | &dst_memory_type_id));
|
1885 | 1878 |
|
1886 |
| - const auto torch_dtype = |
1887 |
| - ConvertDataTypeToTorchType(batch_input.DataType()); |
| 1879 | + const auto torch_dtype = ConvertDataTypeToTorchType(batch_input.DataType()); |
1888 | 1880 | torch::TensorOptions options{torch_dtype.second};
|
1889 |
| - auto updated_options = (dst_memory_type == TRITONSERVER_MEMORY_GPU) |
1890 |
| - ? options.device(torch::kCUDA, device_.index()) |
1891 |
| - : options.device(torch::kCPU); |
| 1881 | + auto updated_options = options.device(torch::kCPU); |
1892 | 1882 |
|
1893 | 1883 | torch::Tensor input_tensor = torch::from_blob(
|
1894 |
| - const_cast<char*>(dst_buffer), shape, |
1895 |
| - updated_options.dtype(torch_dtype.second)); |
| 1884 | + const_cast<char*>(dst_buffer), shape, updated_options); |
1896 | 1885 | (*input_tensors)[input_index_map_[input_name]] = input_tensor;
|
1897 | 1886 | }
|
1898 | 1887 | }
|
|
0 commit comments