tensorflow/cc/experimental/libtf/runtime/runtime.cc
// Instantiate the Runtime, creating relevant Callables for later use.
Instantiate the Runtime, creating relevant Callables for later use.
Instantiate the Runtime creating relevant Callables for later use .
Runtime::Runtime(AbstractContext* ctx) {
  TaggedValue ctx_capsule =
      TaggedValue::Capsule(static_cast<void*>(ctx), [](void* p) {
        auto ctx = static_cast<AbstractContext*>(p);
        ctx->Release();
      });
  Set(String("ctx"), Handle(ctx_capsule));
  auto Load = [](Object self, String name) -> Object {
    auto ctx_capsule = self.Get<internal::Capsule>(String("ctx")).ValueOrDie();
    auto ctx = ctx_capsule.cast<AbstractContext*>();
    return *Cast<Object>(Handle(*ImportModule(name, ctx)));
  };
  Set(String("Load"), Callable(TFLIB_CALLABLE_ADAPTOR(Load)));
}
Runtime :: Runtime ( AbstractContext * ctx ) { TaggedValue ctx_capsule = TaggedValue :: Capsule ( static_cast < void * > ( ctx ) , [ ] ( void * p ) { auto ctx = static_cast < AbstractContext * > ( p ) ; ctx -> Release ( ) ; } ) ; Set ( String ( " " ) , Handle ( ctx_capsule ) ) ; auto Load = [ ] ( Object self , String name ) -> Object { auto ctx_capsule = self . Get < internal :: Capsule > ( String ( " " ) ) . ValueOrDie ( ) ; auto ctx = ctx_capsule . cast < AbstractContext * > ( ) ; return * Cast < Object > ( Handle ( * ImportModule ( name , ctx ) ) ) ; } ; Set ( String ( " " ) , Callable ( TFLIB_CALLABLE_ADAPTOR ( Load ) ) ) ; }
Instantiate the Runtime, creating relevant Callables for later use.
Instantiate the Runtime creating relevant Callables for later use .
// TODO(b/191689645): This needs to do error handling better.