@@ -91,7 +91,7 @@ Tensor(MatMul):0, dtype=float32, shape=[None, 1], "MatMul:0"
9191
9292#+end_SRC
9393
94- The output of Listing [[tf-print-graph]] shows us the underlying operators (e.g. ~MatMul~,
94+ The output of [[tf-print-graph]] shows us the underlying operators (e.g. ~MatMul~,
9595~Placeholder~, ~AddV2~) and their arguments.
9696
9797To "match/search for" combinations of TensorFlow operations--or, in other words, graphs--like
@@ -188,7 +188,7 @@ TFlowMetaTensor(
188188
189189#+end_SRC
190190
191- In Listing [[create-meta-graph]], we created a graph of src_python[:eval never]{1} plus
191+ In [[create-meta-graph]], we created a graph of src_python[:eval never]{1} plus
192192a src_python[:eval never]{unification} logic variable with the name src_python[:eval never]{'a'}. This
193193wouldn't be possible with a standard TensorFlow graph.
194194
@@ -308,7 +308,7 @@ an src_python[:eval never]{etuple} can be manipulated until all of its constitue
308308variables and meta objects are eventually replaced with valid arguments to the
309309function/operator. At that point, the src_python[:eval never]{etuple} can be evaluated.
310310
311- For example, in Listing [[etuple-eval-example]], we create an src_python[:eval never]{etuple}
311+ For example, in [[etuple-eval-example]], we create an src_python[:eval never]{etuple}
312312that uses the TensorFlow function src_python[:eval never]{tf.add} with a logic variable argument.
313313#+NAME: etuple-eval-example
314314#+BEGIN_SRC python :exports code :results none
@@ -318,7 +318,7 @@ add_tf_pat = etuple(tf.add, x_lv, y_lv)
318318#+END_SRC
319319
320320Normally, it wouldn't be possible to call this function with these argument
321- types, as demonstrated in Listing [[etuple-bad-usage-example]].
321+ types, as demonstrated in [[etuple-bad-usage-example]].
322322
323323#+NAME: etuple-bad-usage-example
324324#+BEGIN_SRC python :exports both :results output :wrap "SRC python :eval never"
@@ -345,7 +345,7 @@ its src_python[:eval never]{ExpressionTuple.eval_obj} property. However, after
345345performing a simple manipulation that replaces the logic variable with valid
346346inputs to src_python[:eval never]{tf.add}, we are able to evaluate
347347the src_python[:eval never]{etuple} and obtain a TF Tensor result, as
348- demonstrated in Listings [[etuple-reify-example]] and
348+ demonstrated in [[etuple-reify-example]] and
349349[[etuple-reify-eval-print-example]].
350350
351351#+NAME: etuple-reify-example
@@ -388,10 +388,10 @@ objects that, through the use of src_python[:eval never]{eval}, could achieve
388388the same results--albeit without the more convenient tuple-like structuring.
389389
390390* Meta Operators and their Parameters
391- In Listing [[etuplize-graph-print]], the src_python[:eval never]{etuple} form of
391+ In [[etuplize-graph-print]], the src_python[:eval never]{etuple} form of
392392our matrix multiplication graph, src_python[:eval never]{z_sexp}, produced
393393src_python[:eval never]{symbolic_pymc.tensorflow.meta.TFlowMetaOperator}
394- in the function/operator position. Listing [[print-etuple-operator]] prints
394+ in the function/operator position. [[print-etuple-operator]] prints
395395only the function part of the src_python[:eval never]{etuple}.
396396
397397#+NAME: print-etuple-operator
@@ -438,7 +438,7 @@ src_python[:eval never]{Operation}'s src_python[:eval never]{OpDef}. Notice tha
438438src_python[:eval never]{NodeDef} in the meta operator for src_python[:eval never]{tf.matmul}
439439has a src_python[:eval never]{dict} containing src_python[:eval never]{transpose_*} entries.
440440These are the default values for the TF function src_python[:eval never]{tf.matmul} (see
441- Listing [[print-tf-matmul]]).
441+ [[print-tf-matmul]]).
442442
443443#+NAME: print-tf-matmul
444444#+BEGIN_SRC python :exports both :results output :wrap "SRC python :eval never"
@@ -481,7 +481,7 @@ Patterns, in this case, take the form of meta graphs or S-expr graphs with the
481481desired structure and logic variables in place of "unknown" or arbitrary terms
482482that we might like to reference elsewhere.
483483
484- Listing [[matmul-pattern]] represents an S-expr that evaluates to a graph in
484+ [[matmul-pattern]] represents an S-expr that evaluates to a graph in
485485which two terms are matrix-multiplied.
486486#+NAME: matmul-pattern
487487#+BEGIN_SRC python :exports code :results none
@@ -497,7 +497,7 @@ matmul_pat_mt = matmul_op_mt(A_lv, B_lv)
497497matmul_pat = etuplize(matmul_pat_mt)
498498#+END_SRC
499499
500- In Listing [[matmul-pattern]] we created a meta
500+ In [[matmul-pattern]] we created a meta
501501graph, src_python[:eval never]{matmul_pat_mt}, from a meta
502502TF src_python[:eval never]{MatMul} operator and a
503503variable src_python[:eval never]{NodeDef}, then we applied that meta operator to
@@ -590,7 +590,7 @@ our "pattern" with the matches obtained by src_python[:eval never]{unify} that a
590590within the variable src_python[:eval never]{s}, or we could specify our own substitutions
591591based on that information.
592592
593- In Listing [[matmul-pattern-reify]], we simply change the src_python[:eval never]{'name'} value in the
593+ In [[matmul-pattern-reify]], we simply change the src_python[:eval never]{'name'} value in the
594594and create a new graph with that value. The end result is a version of the original
595595graph, src_python[:eval never]{z_sexp}, with a new name.
596596#+NAME: matmul-pattern-reify
@@ -684,13 +684,13 @@ and src_python[:eval never]{y_lv} mapped to their template-corresponding objects
684684in another graph, we can reify src_python[:eval never]{output_pat} and obtain a
685685"transformed" version of said graph.
686686
687- Using our earlier unification results in Listing [[matmul-pattern-unify]], we only
687+ Using our earlier unification results in [[matmul-pattern-unify]], we only
688688need to reify our output pattern, src_python[:eval never]{output_pat}, with
689689those mappings. However, since our output pattern refers to logic variables
690690src_python[:eval never]{x_lv} and src_python[:eval never]{y_lv}, we'll need
691691to unify those logic variables with the appropriate terms in the graph.
692692
693- Listing [[dist-add-unify]], unifies the remaining terms by simply extracting the
693+ [[dist-add-unify]], unifies the remaining terms by simply extracting the
694694src_python[:eval never]{B} argument in the matrix multiply and unifying
695695that with a pattern for tensor addition.
696696
@@ -764,7 +764,7 @@ Normally, a user will only need to construct compound goals from a basic set of
764764primitives. Arguably, the most primitive goal is the [[https://en.wikipedia.org/wiki/Equivalence_relation][equivalence relation]]
765765under unification denoted by src_python[:eval never]{eq} in Python.
766766
767- In Listing [[mk-basics-eq]], we ask for all successful results/reifications (signified
767+ In [[mk-basics-eq]], we ask for all successful results/reifications (signified
768768by the src_python[:eval never]{0} argument) of the logic variable src_python[:eval never]{var('q')} for the goal
769769src_python[:eval never]{eq(var('q'), 1)}--i.e. unify src_python[:eval never]{var('q')} with src_python[:eval never]{1}.
770770
@@ -814,7 +814,7 @@ pprint(mk_res)
814814
815815#+end_SRC
816816
817- In Listing [[mk-basics-lall]], we used src_python[:eval never]{lall} to obtain the conjunction of two unification goals.
817+ In [[mk-basics-lall]], we used src_python[:eval never]{lall} to obtain the conjunction of two unification goals.
818818Since we requested that the same logic variable be unified
819819with both src_python[:eval never]{1} and src_python[:eval never]{2} simultaneously (i.e. in the same
820820state), which isn't possible, we got back an empty stream of results--indicating failure.
@@ -839,7 +839,7 @@ pprint(mk_res)
839839
840840#+end_SRC
841841
842- The goal disjunction results in Listing [[mk-basics-lany-print]] show that the logic variable
842+ The goal disjunction results in [[mk-basics-lany-print]] show that the logic variable
843843src_python[:eval never]{q_lv} can be unified with either src_python[:eval never]{1} *or* src_python[:eval never]{2} under the
844844two unification goals.
845845
@@ -874,14 +874,14 @@ pprint(mk_res)
874874
875875#+end_SRC
876876
877- In Listing [[mk-basics-conde]], we introduced another logic
877+ In [[mk-basics-conde]], we introduced another logic
878878variable, src_python[:eval never]{r_lv}, and requested the reified values of a list
879879containing both logic variables. The output resembles the idea that
880880if src_python[:eval never]{q_lv} is "equal" to src_python[:eval never]{1}, then src_python[:eval never]{r_lv} is "equal"
881881to src_python[:eval never]{10}, etc. Unlike normal conditionals, each clause/branch isn't
882882exclusive, instead each is realized when the goals in a branch can be successful.
883883
884- Listing [[mk-basics-conde-exclusive]], demonstrates when src_python[:eval never]{conde} can behave more
884+ [[mk-basics-conde-exclusive]], demonstrates when src_python[:eval never]{conde} can behave more
885885like a traditional conditional statement.
886886#+NAME: mk-basics-conde-exclusive
887887#+BEGIN_SRC python :exports code :results none
@@ -936,7 +936,7 @@ Tensor(AddV2):0, dtype=float32, shape=~_14, "add:0"
936936#+end_SRC
937937
938938We didn't need to use the goal conjunction operator src_python[:eval never]{lall} explicitly
939- in Listing [[mk-distribute]], because all remaining goal arguments
939+ in [[mk-distribute]], because all remaining goal arguments
940940to src_python[:eval never]{run} are automatically applied in conjunction.
941941
942942When combinations of miniKanren goals comprise logical units, we can wrap their
@@ -999,7 +999,7 @@ Tensor(AddV2):0, dtype=~_27, shape=~_28, "AddV2:0"
999999
10001000#+end_SRC
10011001
1002- Now, in Listing [[mk-dist-goal-contract-distribute]] we "contract" the graph using
1002+ Now, in [[mk-dist-goal-contract-distribute]] we "contract" the graph using
10031003the previously "expanded" results.
10041004
10051005#+NAME: mk-dist-goal-contract-distribute
@@ -1009,12 +1009,12 @@ mk_res = run(1, q_lv, distributeo(q_lv, z_expanded_mt))
10091009z_contracted_mt = mk_res[0]
10101010#+END_SRC
10111011
1012- #+NAME: mk-dist-goal-contract-distribute
1012+ #+NAME: mk-dist-goal-contract-distribute-print
10131013#+BEGIN_SRC python :exports both :results output :wrap "SRC python :eval never"
10141014tf_dprint(z_contracted_mt)
10151015#+END_SRC
10161016
1017- #+RESULTS: mk-dist-goal-contract-distribute
1017+ #+RESULTS: mk-dist-goal-contract-distribute-print
10181018#+begin_SRC python :eval never
10191019Tensor(MatMul):0, dtype=~_38, shape=~_42, "~_44"
10201020| Tensor(Placeholder):0, dtype=float32, shape=[None, None], "A:0"
@@ -1034,7 +1034,7 @@ Symbolic PyMC introduces some miniKanren goals that apply other goals throughout
10341034graphs until a fixed-point is reached. This sequence of operations is generally
10351035necessary for graph simplification and rewriting.
10361036
1037- In Listing [[mk-dist-goal-gapply-distribute]] we create a new graph that
1037+ In [[mk-dist-goal-gapply-distribute]] we create a new graph that
10381038contains src_python[:eval never]{tf.matmul(A, x + y)} as a subgraph.
10391039Using src_python[:eval never]{graph_applyo},
10401040our src_python[:eval never]{distributeo} relation is applied all throughout the
0 commit comments