Struct ReplicatedObj¶
Defined in File deploy.h
Struct Documentation¶
-
struct ReplicatedObj¶
ReplicatedObj represents a python object that can be used on multiple interpreters.
Calling methods on this will pick an arbitrary interpreter to run on, transfer it there if not already and run the method. A replicated object can be converted to an interpreter specific
Obj
usingInterpreterSession::fromMovable(ReplicatedObj)
Public Functions
-
inline ReplicatedObj()¶
-
InterpreterSession acquireSession(const Interpreter *onThisInterpreter = nullptr) const¶
Creates a new InterpreterSession on onThisInterpreter if specified else uses an arbitrary one from InteprreterManager.
-
inline at::IValue operator()(at::ArrayRef<at::IValue> args) const¶
-
inline at::IValue callKwargs(std::vector<at::IValue> args, std::unordered_map<std::string, c10::IValue> kwargs) const¶
Invokes the Python function or class on an arbitrary interpreter with arguments given by the tuple args and named arguments given by the dictionary kwargs (equivalent to python’s
__call__
).
-
inline at::IValue callKwargs(std::unordered_map<std::string, c10::IValue> kwargs) const¶
Invokes the Python function or class on an arbitrary interpreter.with named arguments given by the dictionary kwargs (equivalent to python’s
__call__
).
-
inline bool hasattr(const char *attr) const¶
Returns true if
ReplicatedObj
has attribute with nameattr
and false otherwise.This is done on an arbitrary
InterpreterSession
which belongs to theReplicatedObj
’s manager.
-
void unload(const Interpreter *onThisInterpreter = nullptr)¶
Deletes
ReplicatedObj
from onThisInterpreter, if onThisInterpreter isnullptr
, unload is called on all interpreters belonging to the ReplicatedObject’s InterpreterManager.
-
Obj toObj(InterpreterSession *I)¶
Converts
ReplicatedObj
toObj
onInterpreterSession
I
-
inline ReplicatedObj()¶