tvm
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
tvm::meta_schedule::PyCostModelNode Class Reference

The cost model with customized methods on the python-side. More...

#include <cost_model.h>

Inheritance diagram for tvm::meta_schedule::PyCostModelNode:
Collaboration diagram for tvm::meta_schedule::PyCostModelNode:

Public Types

using FLoad = ffi::TypedFunction< void(String)>
 Load the cost model from given file location. More...
 
using FSave = ffi::TypedFunction< void(String)>
 Save the cost model to given file location. More...
 
using FUpdate = ffi::TypedFunction< void(const TuneContext &, const Array< MeasureCandidate > &, const Array< RunnerResult > &)>
 Update the cost model given running results. More...
 
using FPredict = ffi::TypedFunction< void(const TuneContext &, const Array< MeasureCandidate > &, void *p_addr)>
 Predict the running results of given measure candidates. More...
 
using FAsString = ffi::TypedFunction< String()>
 Get the cost model as string with name. More...
 

Public Member Functions

void Load (const String &path)
 Load the cost model from given file location. More...
 
void Save (const String &path)
 Save the cost model to given file location. More...
 
void Update (const TuneContext &context, const Array< MeasureCandidate > &candidates, const Array< RunnerResult > &results)
 Update the cost model given running results. More...
 
std::vector< double > Predict (const TuneContext &context, const Array< MeasureCandidate > &candidates)
 Predict the normalized score (the larger the better) of given measure candidates. More...
 
 TVM_DECLARE_FINAL_OBJECT_INFO (PyCostModelNode, CostModelNode)
 
- Public Member Functions inherited from tvm::meta_schedule::CostModelNode
virtual ~CostModelNode ()=default
 Virtual destructor. More...
 
 TVM_DECLARE_BASE_OBJECT_INFO (CostModelNode, Object)
 

Public Attributes

FLoad f_load
 The packed function to the Load function. More...
 
FSave f_save
 The packed function to the Save function. More...
 
FUpdate f_update
 The packed function to the Update function. More...
 
FPredict f_predict
 The packed function to the Predict function. More...
 
FAsString f_as_string
 The packed function to the AsString function. More...
 

Static Public Attributes

static constexpr const char * _type_key = "meta_schedule.PyCostModel"
 
- Static Public Attributes inherited from tvm::meta_schedule::CostModelNode
static constexpr const char * _type_key = "meta_schedule.CostModel"
 

Detailed Description

The cost model with customized methods on the python-side.

Member Typedef Documentation

◆ FAsString

using tvm::meta_schedule::PyCostModelNode::FAsString = ffi::TypedFunction<String()>

Get the cost model as string with name.

Returns
The string representation of the cost model.

◆ FLoad

using tvm::meta_schedule::PyCostModelNode::FLoad = ffi::TypedFunction<void(String)>

Load the cost model from given file location.

Parameters
pathThe file path.

◆ FPredict

using tvm::meta_schedule::PyCostModelNode::FPredict = ffi::TypedFunction<void(const TuneContext&, const Array<MeasureCandidate>&, void* p_addr)>

Predict the running results of given measure candidates.

Parameters
contextThe tuning context.
candidatesThe measure candidates.
p_addrThe address to save the estimated running results.

◆ FSave

using tvm::meta_schedule::PyCostModelNode::FSave = ffi::TypedFunction<void(String)>

Save the cost model to given file location.

Parameters
pathThe file path.

◆ FUpdate

using tvm::meta_schedule::PyCostModelNode::FUpdate = ffi::TypedFunction<void(const TuneContext&, const Array<MeasureCandidate>&, const Array<RunnerResult>&)>

Update the cost model given running results.

Parameters
contextThe tuning context.
candidatesThe measure candidates.
resultsThe running results of the measure candidates.
Returns
Whether cost model was updated successfully.

Member Function Documentation

◆ Load()

void tvm::meta_schedule::PyCostModelNode::Load ( const String &  path)
virtual

Load the cost model from given file location.

Parameters
pathThe file path.

Implements tvm::meta_schedule::CostModelNode.

◆ Predict()

std::vector<double> tvm::meta_schedule::PyCostModelNode::Predict ( const TuneContext context,
const Array< MeasureCandidate > &  candidates 
)
virtual

Predict the normalized score (the larger the better) of given measure candidates.

Parameters
contextThe tuning context.
candidatesThe measure candidates.
Returns
The predicted normalized score.

Implements tvm::meta_schedule::CostModelNode.

◆ Save()

void tvm::meta_schedule::PyCostModelNode::Save ( const String &  path)
virtual

Save the cost model to given file location.

Parameters
pathThe file path.

Implements tvm::meta_schedule::CostModelNode.

◆ TVM_DECLARE_FINAL_OBJECT_INFO()

tvm::meta_schedule::PyCostModelNode::TVM_DECLARE_FINAL_OBJECT_INFO ( PyCostModelNode  ,
CostModelNode   
)

◆ Update()

void tvm::meta_schedule::PyCostModelNode::Update ( const TuneContext context,
const Array< MeasureCandidate > &  candidates,
const Array< RunnerResult > &  results 
)
virtual

Update the cost model given running results.

Parameters
contextThe tuning context.
candidatesThe measure candidates.
resultsThe running results of the measure candidates.

Implements tvm::meta_schedule::CostModelNode.

Member Data Documentation

◆ _type_key

constexpr const char* tvm::meta_schedule::PyCostModelNode::_type_key = "meta_schedule.PyCostModel"
staticconstexpr

◆ f_as_string

FAsString tvm::meta_schedule::PyCostModelNode::f_as_string

The packed function to the AsString function.

◆ f_load

FLoad tvm::meta_schedule::PyCostModelNode::f_load

The packed function to the Load function.

◆ f_predict

FPredict tvm::meta_schedule::PyCostModelNode::f_predict

The packed function to the Predict function.

◆ f_save

FSave tvm::meta_schedule::PyCostModelNode::f_save

The packed function to the Save function.

◆ f_update

FUpdate tvm::meta_schedule::PyCostModelNode::f_update

The packed function to the Update function.


The documentation for this class was generated from the following file: