tf-encrypted / moose

Secure distributed dataflow framework for encrypted machine learning and data processing
Apache License 2.0
58 stars 15 forks source link

Discussion: Should values hold a reference to the session in which they belong? #790

Open mortendahl opened 2 years ago

mortendahl commented 2 years ago

This is a discussion issue to collect thoughts.

Question is whether values should hold an explicit reference to the session in which they belong?

This would allow us to redirect for instance x.shape() to x.plc.shape(&x.session, &x) (since they already hold their placement).

For symbolic values this has already been considered to allow SymbolicHandle to check eg type signatures against the operations in the computation, which it currently cannot do since it only holds the name of the operation (it cannot even verify that the operation really exists in the computation).

For future eager values this might also be nice.

mortendahl commented 2 years ago

An alternative might be to expand on with_context! (if needed, @voronaam?) so that the above could also be written as with_context!(plc, sess, x.shape()).

The two might also work in conjunction so that we could have with_context!(plc, x.shape()), ie without mentioning sess.