Skip to content

Commit cc0657e

Browse files
committed
MR comments
1 parent da3effb commit cc0657e

File tree

1 file changed

+3
-52
lines changed

1 file changed

+3
-52
lines changed

src/libtorch.cc

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

2727
#include <stdint.h>
28-
<<<<<<< HEAD
29-
30-
=======
31-
>>>>>>> implicit state management
32-
#include <cstdint>
3328
#include <exception>
3429

3530
#include "libtorch_utils.h"
@@ -41,7 +36,6 @@
4136
#include "triton/backend/backend_output_responder.h"
4237
#include "triton/common/nvtx.h"
4338
#include "triton/core/tritonbackend.h"
44-
#include "triton/core/tritonserver.h"
4539

4640
#ifdef TRITON_PYTORCH_ENABLE_TORCHVISION
4741
// Suppress warnings in torch headers
@@ -153,7 +147,9 @@ class ModelState : public BackendModel {
153147
torch_models_;
154148

155149
// model_outputs is a map that contains unique outputs that the model must
156-
// provide. In the model configuration, the output in the state configuration
150+
// provide. The first pair is the model output index and the second is
151+
// the index in the model state, -1 is used if one is not required.
152+
// In the model configuration, the output in the state configuration
157153
// can have intersection with the outputs section of the model. If an output
158154
// is specified both in the output section and state section, it indicates
159155
// that the backend must return the output state to the client too.
@@ -539,10 +535,6 @@ class ModelInstanceState : public BackendModelInstance {
539535
TRITONSERVER_Error* ValidateTypedSequenceControl(
540536
triton::common::TritonJson::Value& sequence_batching,
541537
const std::string& control_kind, bool required, bool* have_control);
542-
void AddInputToMap(
543-
NamingConvention naming_convention,
544-
const std::vector<std::string> allowed_inputs, const std::string& io_name,
545-
const uint32_t index);
546538
TRITONSERVER_Error* ValidateInputs(const size_t expected_input_cnt);
547539
void AddInputToMap(
548540
NamingConvention naming_convention,
@@ -814,42 +806,6 @@ ModelInstanceState::ValidateTypedSequenceControl(
814806

815807
return nullptr; // success
816808
}
817-
void
818-
ModelInstanceState::AddInputToMap(
819-
NamingConvention naming_convention,
820-
const std::vector<std::string> allowed_inputs, const std::string& io_name,
821-
const uint32_t index)
822-
{
823-
std::string deliminator = "__";
824-
825-
if (is_dict_input_) {
826-
// If dictionary, index is irrelevant but we use the map to store the
827-
// input names since they are the keys for the dictionary
828-
input_index_map_[io_name] = index;
829-
} else {
830-
switch (naming_convention) {
831-
case NamingConvention::FORWARD_ARGUMENT: {
832-
auto itr =
833-
std::find(allowed_inputs.begin(), allowed_inputs.end(), io_name);
834-
if (itr != allowed_inputs.end()) {
835-
input_index_map_[io_name] =
836-
std::distance(allowed_inputs.begin(), itr);
837-
}
838-
return;
839-
}
840-
case NamingConvention::NAMED_INDEX: {
841-
int start_pos = io_name.find(deliminator);
842-
int ip_index = std::atoi(io_name.substr(start_pos + 2).c_str());
843-
input_index_map_[io_name] = ip_index;
844-
return;
845-
}
846-
case NamingConvention::STRICT_CONFIG_ORDERING: {
847-
input_index_map_[io_name] = index;
848-
return;
849-
}
850-
}
851-
}
852-
}
853809

854810
void
855811
ModelInstanceState::AddInputToMap(
@@ -972,10 +928,6 @@ ModelInstanceState::ValidateInputs(const size_t expected_input_cnt)
972928
std::string io_name;
973929
RETURN_IF_ERROR(io.MemberAsString("name", &io_name));
974930
AddInputToMap(naming_convention, allowed_inputs, io_name, i);
975-
<<<<<<< HEAD
976-
=======
977-
978-
>>>>>>> implicit state management
979931
// Validate data type
980932
std::string io_dtype;
981933
RETURN_IF_ERROR(io.MemberAsString("data_type", &io_dtype));
@@ -1035,7 +987,6 @@ ModelInstanceState::ValidateInputs(const size_t expected_input_cnt)
1035987
.c_str());
1036988
}
1037989

1038-
1039990
// Validate shape for String inputs. Only allow 1 dimension.
1040991
if (state_dtype == "TYPE_STRING") {
1041992
std::vector<int64_t> dims;

0 commit comments

Comments
 (0)