Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vvchernov committed Feb 21, 2022
1 parent 18b68a2 commit e668147
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 8 additions & 6 deletions include/tvm/runtime/vm/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ struct VMFunction {
instructions(std::move(instructions)),
register_file_size(register_file_size),
param_device_indexes(std::move(param_device_indexes)) {
ICHECK_EQ(params.size(), param_device_indexes.size())
<< "The number of provided parameters doesn't match the number of assigned devices";
}
ICHECK_EQ(params.size(), param_device_indexes.size())
<< "The number of provided parameters doesn't match the number of assigned devices";
}

VMFunction() = default;

Expand Down Expand Up @@ -280,7 +280,7 @@ class VirtualMachine : public runtime::ModuleNode {
* function. If the tensor is not of the correct device for the function,
* they will be copied to the device.
*/
void SetOneInputTensor(std::string func_name, TVMArgs args);
void SetOneInputTensor(std::string name, TVMArgs args);

/*!
* \brief Internal hook for profiling the start of an op.
Expand All @@ -305,15 +305,17 @@ class VirtualMachine : public runtime::ModuleNode {
* \param input_name The input tensor name.
* \return The input tensor index.
*/
int64_t getInputIndexFromVMFunction(const std::string& func_name, const std::string& input_name) const;
int64_t getInputIndexFromVMFunction(const std::string& func_name,
const std::string& input_name) const;

/*!
* \brief Get index of input tensor from its name.
* \param params parameter names.
* \param input_name The input tensor name.
* \return The input tensor index.
*/
int64_t getInputIndexFromName(const std::vector<std::string>& params, const std::string& input_name) const;
int64_t getInputIndexFromName(const std::vector<std::string>& params,
const std::string& input_name) const;

/*!
* \brief Check executable exists and get VM function from it.
Expand Down
8 changes: 5 additions & 3 deletions src/runtime/vm/vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,19 @@ void VirtualMachine::SetInput(std::string func_name, TVMArgs args, int offset) {
}

void VirtualMachine::SetOneInputTensor(std::string func_name, TVMArgs args) {
ICHECK_EQ(args.size(), 3) << "The expected number of arguments is 3 (func_name, index or name, tensor)";
ICHECK_EQ(args.size(), 3) << "The expected number of arguments is 3 "
<< "(func_name, index or name, tensor)";
const auto& vm_func = checkAndGetVMFunction(func_name);
size_t params_num = vm_func.params.size();

int inp_index;
if (args[1].type_code() == kTVMArgInt) {
inp_index = args[1];
} else if (args[1].type_code() == kTVMStr) {
inp_index = int(getInputIndexFromName(vm_func.params, args[1]));
inp_index = static_cast<int>(getInputIndexFromName(vm_func.params, args[1]));
} else {
LOG(FATAL) << "The second argument type (" << args[1].type_code() << ") doesn't match integer or string";
LOG(FATAL) << "The second argument type (" << args[1].type_code()
<< ") doesn't match integer or string";
}
ICHECK_LT(inp_index, params_num);

Expand Down

0 comments on commit e668147

Please sign in to comment.