Skip to content

Promise and PromiseTensor #2515

@iamtrask

Description

@iamtrask

In this issue, I will be creating a new tensor type called PromiseTensor. This Issue will be updated to reflect what I intend to build as I am working on it.

This will allow one worker to:

  1. tell another worker that it will receive a tensor with a certain id in the future.
x = th.tensor([1,2,3,4]).promise() # initialize a promise
x_promise = sy.PromiseTensor() # alternative promise initialization
ptr_to_x_promise = x_promise.send(bob)
  1. give another worker a list of operations to execute once the tensor arrives.
# send Bob an operation to execute once the promise x is fulfilled - returns promise y
ptr_to_y_promise = ptr_to_x_promise + ptr_to_x_promise 

# send Bob an operation to execute once the promise y is fulfilled
ptr_to_z_promise = ptr_to_y_promise + ptr_to_y_promise
  1. keep the promise at any time
ptr_to_z = x.keep(th.tensor([1,2,3])
z = ptr_to_z.get()

However, while this above example uses a PromiseTensor, the promise architecture should be created as a generic Promise object (not unlike our generic Pointer object).

Metadata

Metadata

Assignees

Labels

Status: Stale 🍞Been open for a while with no activityType: New Feature ➕Introduction of a completely new addition to the codebase

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions