Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
comaniac committed Aug 26, 2020
1 parent 2b7a3f8 commit 3c24580
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/auto_scheduler/cost_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ TVM_REGISTER_OBJECT_TYPE(CostModelNode);
TVM_REGISTER_OBJECT_TYPE(RandomModelNode);
TVM_REGISTER_OBJECT_TYPE(PythonBasedModelNode);

void RandomNumber(size_t n, void* data) {
void RandomNumber(TVMArgs args, TVMRetValue* rv) {
int n = args[0];
void* data = args[1];
float* fdata = reinterpret_cast<float*>(data);
for (size_t i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
fdata[i] = static_cast<float>(rand_r(nullptr)) / (static_cast<float>(RAND_MAX));
}
}
Expand All @@ -44,11 +46,10 @@ RandomModel::RandomModel() {
if (node->random_number_func == nullptr) {
LOG(WARNING) << "auto_scheduler.cost_model.random_fill_float is not registered, "
<< "use C++ default random_number func instead.";
static TypedPackedFunc<void(size_t, void*)> cost_model_random_number(RandomNumber);
node->random_number_func = &cost_model_random_number;
} else {
node->random_number_func = reinterpret_cast<const TypedPackedFunc<void(size_t, void*)>*>(f);
const auto pf = PackedFunc(RandomNumber);
f = &pf;
}
node->random_number_func = reinterpret_cast<const TypedPackedFunc<void(size_t, void*)>*>(f);
data_ = std::move(node);
}

Expand Down

0 comments on commit 3c24580

Please sign in to comment.