Shortcuts

Struct ReplicatedObj

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 using InterpreterSession::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 name attr and false otherwise.

This is done on an arbitrary InterpreterSession which belongs to the ReplicatedObj’s manager.

void unload(const Interpreter *onThisInterpreter = nullptr)

Deletes ReplicatedObj from onThisInterpreter, if onThisInterpreter is nullptr, unload is called on all interpreters belonging to the ReplicatedObject’s InterpreterManager.

Obj toObj(InterpreterSession *I)

Converts ReplicatedObj to Obj on InterpreterSession I

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources