tensorflow::ClientSession
#include <client_session.h> ClientSession nesnesi, çağıranın C++ API'si ile oluşturulan TensorFlow grafiğinin değerlendirmesini yönlendirmesine olanak tanır.
Özet
Örnek:
Scope root = Scope::NewRootScope(); auto a = Placeholder(root, DT_INT32); auto c = Add(root, a, {41}); ClientSession session(root); std::vectoroutputs; Status s = session.Run({ {a, {1} } }, {c}, &outputs); if (!s.ok()) { ... }
Yapıcılar ve Yıkıcılar | |
|---|---|
ClientSession (const Scope & scope, const string & target)target ile belirtilen TensorFlow çalışma ortamına bağlanarak scope dahilindeki grafiği değerlendirmek için yeni bir oturum oluşturun. | |
ClientSession (const Scope & scope) Yukarıdakiyle aynı, ancak hedef belirtimi olarak boş dizeyi ("") kullanın. | |
ClientSession (const Scope & scope, const SessionOptions & session_options) Yeni bir oturum oluşturun ve session_options seçenekleriyle yapılandırın. | |
~ClientSession () |
Kamu türleri | |
|---|---|
CallableHandle | typedefint64ClientSession::MakeCallable() ile oluşturulmuş bir alt grafın tanıtıcısı. |
FeedType | typedefstd::unordered_map< Output , Input::Initializer , OutputHash > Run çağrısına gelen verileri temsil etmek için kullanılan bir veri türü. |
Kamusal işlevler | |
|---|---|
MakeCallable (const CallableOptions & callable_options, CallableHandle *out_handle) | Statuscallable_options tarafından tanımlanan alt grafı çağırmak için bir handle oluşturur. |
ReleaseCallable ( CallableHandle handle) | Status Bu oturumda belirtilen handle ilişkili kaynakları serbest bırakır. |
Run (const std::vector< Output > & fetch_outputs, std::vector< Tensor > *outputs) const | Statusfetch_outputs içindeki tensörleri değerlendirin. |
Run (const FeedType & inputs, const std::vector< Output > & fetch_outputs, std::vector< Tensor > *outputs) const | Status Yukarıdakiyle aynı, ancak inputs eşlemeyi besleme olarak kullanın. |
Run (const FeedType & inputs, const std::vector< Output > & fetch_outputs, const std::vector< Operation > & run_outputs, std::vector< Tensor > *outputs) const | Status Yukarıdakiyle aynı. Ek olarak, run_outputs içindeki işlemleri de çalıştırır. |
Run (const RunOptions & run_options, const FeedType & inputs, const std::vector< Output > & fetch_outputs, const std::vector< Operation > & run_outputs, std::vector< Tensor > *outputs, RunMetadata *run_metadata) const | Status Performans profilleme özelliğini etkinleştirmek için run_options kullanın. |
Run (const RunOptions & run_options, const FeedType & inputs, const std::vector< Output > & fetch_outputs, const std::vector< Operation > & run_outputs, std::vector< Tensor > *outputs, RunMetadata *run_metadata, const thread::ThreadPoolOptions & threadpool_options) const | Status Yukarıdakiyle aynı. |
RunCallable ( CallableHandle handle, const std::vector< Tensor > & feed_tensors, std::vector< Tensor > *fetch_tensors, RunMetadata *run_metadata) | Status Belirtilen seçenekler ve giriş tensörleriyle, handle adı verilen alt grafı çağırır. |
RunCallable ( CallableHandle handle, const std::vector< Tensor > & feed_tensors, std::vector< Tensor > *fetch_tensors, RunMetadata *run_metadata, const thread::ThreadPoolOptions & options) | Status Belirtilen seçenekler ve giriş tensörleriyle, handle adı verilen alt grafı çağırır. |
Kamu türleri
ÇağrılabilirTanıtıcı
int64 CallableHandle
ClientSession::MakeCallable() ile oluşturulmuş bir alt grafın tanıtıcısı.
Besleme Türü
std::unordered_map< Output, Input::Initializer, OutputHash > FeedType
Run çağrısına gelen verileri temsil etmek için kullanılan bir veri türü.
Bu, op-yapıcıları tarafından döndürülen Output nesnelerinin, onlara beslenecek değerlere eşlenmesidir. Besleme değerleri olarak nelerin kullanılabileceği hakkında ayrıntılı bilgi için Input::Initializer bakın.
Kamusal işlevler
Müşteri Oturumu
ClientSession( const Scope & scope, const string & target )
target ile belirtilen TensorFlow çalışma ortamına bağlanarak scope dahilindeki grafiği değerlendirmek için yeni bir oturum oluşturun.
Müşteri Oturumu
ClientSession( const Scope & scope )
Yukarıdakiyle aynı, ancak hedef belirtimi olarak boş dizeyi ("") kullanın.
Müşteri Oturumu
ClientSession( const Scope & scope, const SessionOptions & session_options )
Yeni bir oturum oluşturun ve session_options seçenekleriyle yapılandırın.
Çağrılabilir hale getir
Status MakeCallable( const CallableOptions & callable_options, CallableHandle *out_handle )
callable_options tarafından tanımlanan alt grafı çağırmak için bir handle oluşturur.
NOT: Bu API henüz deneysel aşamada olup değişiklik gösterebilir.
ReleaseCallable
Status ReleaseCallable( CallableHandle handle )
Bu oturumda belirtilen handle ilişkili kaynakları serbest bırakır.
NOT: Bu API henüz deneysel aşamada olup değişiklik gösterebilir.
Koşmak
Status Run( const std::vector< Output > & fetch_outputs, std::vector< Tensor > *outputs ) const
fetch_outputs içindeki tensörleri değerlendirin.
Değerler, outputs Tensor nesneleri olarak döndürülür. outputs sayısı ve sırası fetch_outputs ile eşleşecektir.
Koşmak
Status Run( const FeedType & inputs, const std::vector< Output > & fetch_outputs, std::vector< Tensor > *outputs ) const
Yukarıdakiyle aynı, ancak inputs eşlemeyi besleme olarak kullanın.
Koşmak
Status Run( const FeedType & inputs, const std::vector< Output > & fetch_outputs, const std::vector< Operation > & run_outputs, std::vector< Tensor > *outputs ) const
Yukarıdakiyle aynı. Ek olarak, run_outputs içindeki işlemleri de çalıştırır.
Koşmak
Status Run( const RunOptions & run_options, const FeedType & inputs, const std::vector< Output > & fetch_outputs, const std::vector< Operation > & run_outputs, std::vector< Tensor > *outputs, RunMetadata *run_metadata ) const
Performans profilleme özelliğini etkinleştirmek için run_options kullanın.
run_metadata , boş değilse, profil oluşturma sonuçlarıyla doldurulur.
Koşmak
Status Run( const RunOptions & run_options, const FeedType & inputs, const std::vector< Output > & fetch_outputs, const std::vector< Operation > & run_outputs, std::vector< Tensor > *outputs, RunMetadata *run_metadata, const thread::ThreadPoolOptions & threadpool_options ) const
Yukarıdakiyle aynı.
Ayrıca, kullanıcının ThreadPoolOptions aracılığıyla özel bir iş parçacığı havuzu uygulaması sağlamasına olanak tanır.
RunCallable
Status RunCallable( CallableHandle handle, const std::vector< Tensor > & feed_tensors, std::vector< Tensor > *fetch_tensors, RunMetadata *run_metadata )
Belirtilen seçenekler ve giriş tensörleriyle, handle adı verilen alt grafı çağırır.
feed_tensors içindeki tensörlerin sırası, CallableOptions::feed() içindeki isimlerin sırasıyla eşleşmelidir ve fetch_tensors içindeki tensörlerin sırası, bu alt grafik oluşturulduğunda CallableOptions::fetch() içindeki isimlerin sırasıyla eşleşmelidir. NOT: Bu API hala deneyseldir ve değişebilir.
RunCallable
Status RunCallable( CallableHandle handle, const std::vector< Tensor > & feed_tensors, std::vector< Tensor > *fetch_tensors, RunMetadata *run_metadata, const thread::ThreadPoolOptions & options )
Belirtilen seçenekler ve giriş tensörleriyle, handle adı verilen alt grafı çağırır.
feed_tensors içindeki tensörlerin sırası, CallableOptions::feed() içindeki isimlerin sırasıyla eşleşmelidir ve fetch_tensors içindeki tensörlerin sırası, bu alt grafik oluşturulduğunda CallableOptions::fetch() içindeki isimlerin sırasıyla eşleşmelidir. NOT: Bu API hala deneyseldir ve değişebilir.
~MüşteriOturumu
~ClientSession()