- Should I prefer free functions (current) or member functions, or both (or a mixture of both for different subsets)? For instance, Eigen uses
a.cwiseProd(b) instead of CwiseProd(a, b), similarly PyTorch.
- If member functions, is it a member function of
Ptr<Node> or Node?
Some examples for all three:
NodePtr<> a, b;
auto c = CwiseProd(a, b);
auto c = a.cwise_prod(b);
auto c = a->cwise_prod(b);
NodePtr<> a;
auto b = Exp(Sum(Log(a), /*axis*/ 1));
auto b = a.log().sum(/*axis*/ 1).exp();
auto b = a->log()->sum(/*axis*/ 1)->exp();
Considering that we want expressions to be extensible by user, we can only use a library supporting fixed subset as possible member functions which is a drawback.
Due to some early discussions, leaning towards the third option (chaining by -> with pointer semantics, no changes to Ptr).
Another consideration here is that since this is going to be part of the core interface (either Ptr or Node), these core types will need to know about some derived node types which can lead to wonky forward declarations.
a.cwiseProd(b)instead ofCwiseProd(a, b), similarly PyTorch.Ptr<Node>orNode?Some examples for all three:
Considering that we want expressions to be extensible by user, we can only use a library supporting fixed subset as possible member functions which is a drawback.
Due to some early discussions, leaning towards the third option (chaining by -> with pointer semantics, no changes to Ptr).
Another consideration here is that since this is going to be part of the core interface (either
PtrorNode), these core types will need to know about some derived node types which can lead to wonky forward declarations.