TensorFlow Serving C++ API Documentation
Public Member Functions | List of all members
tensorflow::serving::SourceAdapter< InputType, OutputType > Class Template Referenceabstract

#include <source_adapter.h>

Inheritance diagram for tensorflow::serving::SourceAdapter< InputType, OutputType >:
Inheritance graph
[legend]
Collaboration diagram for tensorflow::serving::SourceAdapter< InputType, OutputType >:
Collaboration graph
[legend]

Public Member Functions

void SetAspiredVersions (const StringPiece servable_name, std::vector< ServableData< InputType >> versions) final
 
void SetAspiredVersionsCallback (typename Source< OutputType >::AspiredVersionsCallback callback) final
 
virtual std::vector< ServableData< OutputType > > Adapt (const StringPiece servable_name, std::vector< ServableData< InputType >> versions)=0
 
ServableData< OutputType > AdaptOneVersion (ServableData< InputType > input)
 Adapts a single servable data item. (Implemented on top of Adapt().)
 
- Public Member Functions inherited from tensorflow::serving::TargetBase< InputType >
Source< InputType >::AspiredVersionsCallback GetAspiredVersionsCallback () final
 
- Public Member Functions inherited from tensorflow::serving::Source< OutputType >
virtual void SetAspiredVersionsCallback (AspiredVersionsCallback callback)=0
 Supplies an AspiredVersionsCallback to use. Can be called at most once.
 

Additional Inherited Members

- Public Types inherited from tensorflow::serving::Source< OutputType >
using AspiredVersionsCallback = std::function< void(const StringPiece servable_name, std::vector< ServableData< OutputType > > versions)>
 
- Protected Member Functions inherited from tensorflow::serving::TargetBase< InputType >
void Detach ()
 

Detailed Description

template<typename InputType, typename OutputType>
class tensorflow::serving::SourceAdapter< InputType, OutputType >

An abstraction for a module that receives aspired-version callbacks with data of type InputType and converts them into calls with data of type OutputType.

A common example uses InputType=StoragePath, OutputType=unique_ptr&lt;Loader>, in which case the module "converts" each incoming storage path into a loader capable of loading a (particular type of) servable based on the path.

SourceAdapters are typically stateless. However, as with all Sources they can house state that is shared among multiple emitted servables. See the discussion in source.h.

Implementing subclasses supply an implementation of the Adapt() virtual method, which converts a servable version list from InputType to OutputType.

IMPORTANT: Every leaf derived class must call Detach() at the top of its destructor. (See documentation on TargetBase::Detach() in target.h.) Doing so ensures that no Adapt() calls are in flight during destruction of member variables.

Definition at line 59 of file source_adapter.h.

Member Function Documentation

◆ Adapt()

template<typename InputType , typename OutputType >
virtual std::vector<ServableData<OutputType> > tensorflow::serving::SourceAdapter< InputType, OutputType >::Adapt ( const StringPiece  servable_name,
std::vector< ServableData< InputType >>  versions 
)
pure virtual

Given an InputType-based aspired-versions request, produces a corresponding OutputType-based request.

◆ SetAspiredVersions()

template<typename InputType , typename OutputType >
void tensorflow::serving::SourceAdapter< InputType, OutputType >::SetAspiredVersions ( const StringPiece  servable_name,
std::vector< ServableData< InputType >>  versions 
)
finalvirtual

This method is implemented in terms of Adapt(), which the implementing subclass must supply.

Implements tensorflow::serving::TargetBase< InputType >.

Definition at line 176 of file source_adapter.h.


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