Commit 426e36d6 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower Committed by TensorFlower Gardener
Browse files

Reduce subclass boilerplate by embracing duck-typing and adopting a...

Reduce subclass boilerplate by embracing duck-typing and adopting a "public-calls-private" design pattern. This pattern reduces lines of Distribution sub-class code by ~33%.

Specifically, this change:

1. Makes BaseDistribution purely virtual.
2. The new idiom is that all public methods are implemented in the base class, and all possible argument checking is done there. Subclasses implement _methods called by the base class; if they fail to implement it will fire a NotImplementedError during tf graph construction.
3. Fix style inconsistencies, eg, function order, remove unnecessary indirection, use tf.ones instead of tf.constant, etc.
4. Fix efficiency when I noticed a problem. Example Dirichlet._variance.
Change: 131404360
parent a5629419
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment