Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::serving::SourceAdapter
This is an abstract class.
#include <source_adapter.h>
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.
Summary
A common example uses InputType=StoragePath, OutputType=unique_ptr<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.
Inheritance
Inherits from: TargetBase< InputType >,
tensorflow::serving::Source< OutputType >
Public functions
|
Adapt(const StringPiece servable_name, std::vector< ServableData< InputType >> versions)=0
|
virtual std::vector< ServableData< OutputType > >
Given an InputType-based aspired-versions request, produces a corresponding OutputType-based request.
|
AdaptOneVersion(ServableData< InputType > input)
|
ServableData< OutputType >
Adapts a single servable data item. (Implemented on top of Adapt().)
|
SetAspiredVersions(const StringPiece servable_name, std::vector< ServableData< InputType >> versions) final
|
void
This method is implemented in terms of Adapt(), which the implementing subclass must supply.
|
SetAspiredVersionsCallback(typename Source< OutputType >::AspiredVersionsCallback callback) final
|
void
|
Public functions
Adapt
virtual std::vector< ServableData< OutputType > > Adapt(
const StringPiece servable_name,
std::vector< ServableData< InputType >> versions
)=0
Given an InputType-based aspired-versions request, produces a corresponding OutputType-based request.
AdaptOneVersion
ServableData< OutputType > AdaptOneVersion(
ServableData< InputType > input
)
Adapts a single servable data item. (Implemented on top of Adapt().)
SetAspiredVersions
void SetAspiredVersions(
const StringPiece servable_name,
std::vector< ServableData< InputType >> versions
) final
This method is implemented in terms of Adapt(), which the implementing subclass must supply.
~SourceAdapter
virtual ~SourceAdapter() override=0
Protected functions
SourceAdapter
SourceAdapter()=default
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-19 UTC.
[null,null,["Last updated 2024-01-19 UTC."],[],[],null,["# tensorflow::serving::SourceAdapter Class Reference\n\ntensorflow::serving::SourceAdapter\n==================================\n\n\n**This is an abstract class.**\n\n\n`#include \u003csource_adapter.h\u003e`\n\nAn abstraction for a module that receives aspired-version callbacks with data of type InputType and converts them into calls with data of type OutputType.\n\nSummary\n-------\n\nA common example uses InputType=StoragePath, OutputType=unique_ptr\\\u003c[Loader](/tfx/serving/api_docs/cc/class/tensorflow/serving/loader#classtensorflow_1_1serving_1_1_loader)\\\u003e, 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.\n\nSourceAdapters 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](/tfx/serving/api_docs/cc/other/source.h-source#source_8h_source).\n\nImplementing subclasses supply an implementation of the [Adapt()](/tfx/serving/api_docs/cc/class/tensorflow/serving/source-adapter#classtensorflow_1_1serving_1_1_source_adapter_1a7c960f8493040fc8cb0766e4c2cebf60) virtual method, which converts a servable version list from InputType to OutputType.\n\nIMPORTANT: 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()](/tfx/serving/api_docs/cc/class/tensorflow/serving/source-adapter#classtensorflow_1_1serving_1_1_source_adapter_1a7c960f8493040fc8cb0766e4c2cebf60) calls are in flight during destruction of member variables.\n\n### Inheritance\n\nInherits from: TargetBase\\\u003c InputType \\\u003e, [tensorflow::serving::Source\\\u003c OutputType \\\u003e](/tfx/serving/api_docs/cc/class/tensorflow/serving/source)\n\n| ### Constructors and Destructors ||\n|---|---|\n| [~SourceAdapter](#classtensorflow_1_1serving_1_1_source_adapter_1ad34177fc3cedbb9dbf4acaf6c0a385d9)`()` ||\n\n| ### Public functions ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Adapt](#classtensorflow_1_1serving_1_1_source_adapter_1a7c960f8493040fc8cb0766e4c2cebf60)`(const StringPiece servable_name, std::vector\u003c ServableData\u003c InputType \u003e\u003e versions)=0` | `virtual std::vector\u003c ServableData\u003c OutputType \u003e \u003e` Given an InputType-based aspired-versions request, produces a corresponding OutputType-based request. |\n| [AdaptOneVersion](#classtensorflow_1_1serving_1_1_source_adapter_1a439ae68b02c73dc4266fa6c920674a1e)`(ServableData\u003c InputType \u003e input)` | `ServableData\u003c OutputType \u003e` Adapts a single servable data item. (Implemented on top of [Adapt()](/tfx/serving/api_docs/cc/class/tensorflow/serving/source-adapter#classtensorflow_1_1serving_1_1_source_adapter_1a7c960f8493040fc8cb0766e4c2cebf60).) |\n| [SetAspiredVersions](#classtensorflow_1_1serving_1_1_source_adapter_1a9775d0a39269efb319a0dbd94862f183)`(const StringPiece servable_name, std::vector\u003c ServableData\u003c InputType \u003e\u003e versions) final` | `void` This method is implemented in terms of [Adapt()](/tfx/serving/api_docs/cc/class/tensorflow/serving/source-adapter#classtensorflow_1_1serving_1_1_source_adapter_1a7c960f8493040fc8cb0766e4c2cebf60), which the implementing subclass must supply. |\n| [SetAspiredVersionsCallback](#classtensorflow_1_1serving_1_1_source_adapter_1aa123a0dc11c1c45073e16bb40ae50285)`(typename `[Source](/tfx/serving/api_docs/cc/class/tensorflow/serving/source#classtensorflow_1_1serving_1_1_source)`\u003c OutputType \u003e::`[AspiredVersionsCallback](/tfx/serving/api_docs/cc/class/tensorflow/serving/source#classtensorflow_1_1serving_1_1_source_1a29618ccece5bf8af69d5893ad8b3f2fe)` callback) final` | `void` |\n\n| ### Protected functions ||\n|----------------------------------------------------------------------------------------------------------------|---|\n| [SourceAdapter](#classtensorflow_1_1serving_1_1_source_adapter_1ab8fb3b0cf689644f4eb01e18934a235c)`()=default` | |\n\nPublic functions\n----------------\n\n### Adapt\n\n```gdscript\nvirtual std::vector\u003c ServableData\u003c OutputType \u003e \u003e Adapt(\n const StringPiece servable_name,\n std::vector\u003c ServableData\u003c InputType \u003e\u003e versions\n)=0\n``` \nGiven an InputType-based aspired-versions request, produces a corresponding OutputType-based request. \n\n### AdaptOneVersion\n\n```text\nServableData\u003c OutputType \u003e AdaptOneVersion(\n ServableData\u003c InputType \u003e input\n)\n``` \nAdapts a single servable data item. (Implemented on top of [Adapt()](/tfx/serving/api_docs/cc/class/tensorflow/serving/source-adapter#classtensorflow_1_1serving_1_1_source_adapter_1a7c960f8493040fc8cb0766e4c2cebf60).) \n\n### SetAspiredVersions\n\n```gdscript\nvoid SetAspiredVersions(\n const StringPiece servable_name,\n std::vector\u003c ServableData\u003c InputType \u003e\u003e versions\n) final\n``` \nThis method is implemented in terms of [Adapt()](/tfx/serving/api_docs/cc/class/tensorflow/serving/source-adapter#classtensorflow_1_1serving_1_1_source_adapter_1a7c960f8493040fc8cb0766e4c2cebf60), which the implementing subclass must supply. \n\n### SetAspiredVersionsCallback\n\n```carbon\nvoid SetAspiredVersionsCallback(\n typename Source\u003c OutputType \u003e::AspiredVersionsCallback callback\n) final\n``` \n\n### \\~SourceAdapter\n\n```text\nvirtual ~SourceAdapter() override=0\n``` \n\nProtected functions\n-------------------\n\n### SourceAdapter\n\n```text\n SourceAdapter()=default\n```"]]