TensorFlow Serving C++ API Documentation
Public Member Functions | Static Public Member Functions | List of all members
tensorflow::serving::test_util::FakeLoader Class Reference
Inheritance diagram for tensorflow::serving::test_util::FakeLoader:
Inheritance graph
[legend]
Collaboration diagram for tensorflow::serving::test_util::FakeLoader:
Collaboration graph
[legend]

Public Member Functions

 FakeLoader (int64_t servable, const Status load_status=Status())
 
Status load_status ()
 
Status Load () override
 
void Unload () override
 
AnyPtr servable () override
 
- Public Member Functions inherited from tensorflow::serving::ResourceUnsafeLoader
Status EstimateResources (ResourceAllocation *estimate) const final
 
- Public Member Functions inherited from tensorflow::serving::Loader
virtual ~Loader ()=default
 
virtual Status LoadWithMetadata (const Metadata &metadata)
 

Static Public Member Functions

static int num_fake_loaders ()
 
static bool was_deleted_in_this_thread ()
 

Detailed Description

Definition at line 37 of file fake_loader.h.

Member Function Documentation

◆ Load()

Status tensorflow::serving::test_util::FakeLoader::Load ( )
overridevirtual

Fetches any data that needs to be loaded before using the servable returned by servable(). May use no more resources than the estimate reported by EstimateResources().

If implementing Load(), you don't have to override LoadWithMetadata().

Reimplemented from tensorflow::serving::Loader.

Definition at line 47 of file fake_loader.cc.

◆ servable()

AnyPtr tensorflow::serving::test_util::FakeLoader::servable ( )
overridevirtual

Returns an opaque interface to the underlying servable object. The caller should know the precise type of the interface in order to make actual use of it. For example:

CustomLoader implementation:

class CustomLoader : public Loader {
 public:
  ...
  Status Load() override {
    servable_ = ...;
  }

  AnyPtr servable() override { return servable_; }

 private:
  CustomServable* servable_ = nullptr;
};

Serving user request:

ServableHandle<CustomServable> handle = ...
CustomServable* servable = handle.get();
servable->...

If servable() is called after successful Load() and before Unload(), it returns a valid, non-null AnyPtr object. If called before a successful Load() call or after Unload(), it returns null AnyPtr.

Implements tensorflow::serving::Loader.

Definition at line 51 of file fake_loader.cc.

◆ Unload()

void tensorflow::serving::test_util::FakeLoader::Unload ( )
overridevirtual

Frees any resources allocated during Load() (except perhaps for resources shared across servables that are still needed for other active ones). The loader does not need to return to the "new" state (i.e. Load() cannot be called after Unload()).

Implements tensorflow::serving::Loader.

Definition at line 49 of file fake_loader.cc.


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