Represents a machine trained learning model instance.
More...
#include "services/mlmodel/mlmodel.hpp"
|
template<typename T > |
using | tensor_view = typename make_tensor_view_<T>::type |
|
using | signed_integral_base_types |
|
using | unsigned_integral_base_types |
|
using | integral_base_types |
|
using | fp_base_types = boost::mpl::list<float, double> |
|
using | base_types = boost::mpl::joint_view<integral_base_types, fp_base_types> |
|
using | tensor_view_types |
|
using | tensor_views = boost::make_variant_over<tensor_view_types>::type |
|
using | named_tensor_views = std::unordered_map<std::string, tensor_views> |
|
|
API | api () const override |
| Returns the API associated with a particular resource.
|
|
std::shared_ptr< named_tensor_views > | infer (const named_tensor_views &inputs) |
| Runs the model against the input tensors and returns inference results as tensors.
|
|
virtual std::shared_ptr< named_tensor_views > | infer (const named_tensor_views &inputs, const ProtoStruct &extra)=0 |
| Runs the model against the input tensors and returns inference results as tensors.
|
|
struct metadata | metadata () |
| Returns metadata describing the inputs and outputs of the model.
|
|
virtual struct metadata | metadata (const ProtoStruct &extra)=0 |
| Returns metadata describing the inputs and outputs of the model.
|
|
Name | get_resource_name () const override |
| Returns the Name for a particular resource.
|
|
| Resource (std::string name) |
|
virtual std::string | name () const |
| Return the resource's name.
|
|
|
template<typename T > |
static tensor_view< T > | make_tensor_view (const T *data, std::size_t size, typename tensor_view< T >::shape_type shape) |
|
|
| MLModelService (std::string name) |
|
| Service (std::string name) |
|
Name | get_resource_name (const std::string &type) const |
|
Represents a machine trained learning model instance.
This class acts as an abstract base class to be used by any driver implementing an MLModel. It is also used as the base class for the gRPC client for communicating with a remote MLModel instance.
◆ integral_base_types
using viam::sdk::MLModelService::integral_base_types |
Initial value:
boost::mpl::joint_view<signed_integral_base_types, unsigned_integral_base_types>
◆ signed_integral_base_types
using viam::sdk::MLModelService::signed_integral_base_types |
Initial value:
boost::mpl::list<std::int8_t, std::int16_t, std::int32_t, std::int64_t>
◆ tensor_view_types
using viam::sdk::MLModelService::tensor_view_types |
Initial value:
boost::mpl::transform_view<base_types, make_tensor_view_<boost::mpl::placeholders::_1>>
◆ unsigned_integral_base_types
using viam::sdk::MLModelService::unsigned_integral_base_types |
Initial value:
boost::mpl::transform_view<signed_integral_base_types,
std::make_unsigned<boost::mpl::placeholders::_1>>
◆ api()
API viam::sdk::MLModelService::api |
( |
| ) |
const |
|
overridevirtual |
◆ infer() [1/2]
std::shared_ptr< named_tensor_views > viam::sdk::MLModelService::infer |
( |
const named_tensor_views & | inputs | ) |
|
|
inline |
Runs the model against the input tensors and returns inference results as tensors.
- Parameters
-
`inputs` | The input tensors on which to run inference. |
- Returns
- The results of the inference as a shared pointer to
named_tensor_views
. The data viewed by the views is only valid for the lifetime of the returned shared_ptr.
◆ infer() [2/2]
virtual std::shared_ptr< named_tensor_views > viam::sdk::MLModelService::infer |
( |
const named_tensor_views & | inputs, |
|
|
const ProtoStruct & | extra ) |
|
pure virtual |
Runs the model against the input tensors and returns inference results as tensors.
- Parameters
-
`inputs` | The input tensors on which to run inference. |
`extra` | Any additional arguments to the method. |
- Returns
- The results of the inference as a shared pointer to
named_tensor_views
. The data viewed by the views is only valid for the lifetime of the returned shared_ptr.
Implemented in viam::sdk::impl::MLModelServiceClient, and viam::sdk::impl::MLModelServiceClient.
◆ metadata()
virtual struct metadata viam::sdk::MLModelService::metadata |
( |
const ProtoStruct & | extra | ) |
|
|
pure virtual |
The documentation for this class was generated from the following file: