Skip to content

Commit 3ea11bb

Browse files
committed
Minor edits
1 parent 8aee1c4 commit 3ea11bb

File tree

6 files changed

+29
-19
lines changed

6 files changed

+29
-19
lines changed

sdh-docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,5 @@ <h1 id="system-requirements">System Requirements</h1>
219219

220220
<!--
221221
MkDocs version : 0.17.2
222-
Build Date UTC : 2019-05-30 19:59:15
222+
Build Date UTC : 2019-05-30 23:10:47
223223
-->

sdh-docs/pycomputations/index.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,10 @@ <h2 id="expressing-reductions">Expressing Reductions</h2>
228228
</p>
229229
<p>and demonstrates how matrix-vector multiplication can be expressed in index
230230
notation. Both forms are supported by TACO:</p>
231-
<pre class="highlight"><code class="language-python">y[i] = A[i,j] * x[j]
232-
y[i] = sum(j, A[i,j] * x[j])</code></pre>
231+
<pre class="highlight"><code class="language-python">i, j = pytaco.get_index_vars(2)
232+
233+
y[i] = A[i,j] * x[j]
234+
y[i] = pytaco.sum(j, A[i,j] * x[j])</code></pre>
233235

234236
<p>Reductions that are not explicitly expressed are assumed to be over the
235237
smallest subexpression that captures all uses of the corresponding reduction
@@ -260,6 +262,7 @@ <h1 id="expressing-broadcasts">Expressing Broadcasts</h1>
260262
<pre class="highlight"><code class="language-python">A = pt.tensor([3,3])
261263
B = pt.tensor([3,3])
262264
C = pt.tensor([3,1])
265+
i, j = pt.get_index_vars(2)
263266

264267
A[i, j] = B[i, j] + C[i, j] # ERROR!!</code></pre>
265268

@@ -271,6 +274,7 @@ <h1 id="expressing-transposes">Expressing Transposes</h1>
271274
<pre class="highlight"><code class="language-python">A = pt.tensor([3,3], pt.format([dense, dense]))
272275
B = pt.tensor([3,3], pt.format([dense, dense]))
273276
C = pt.tensor([3,3], pt.format([dense, dense]))
277+
i, j = pt.get_index_vars(2)
274278

275279
A[i,j] = B[i,j] + C[j,i]</code></pre>
276280

@@ -286,15 +290,17 @@ <h1 id="expressing-transposes">Expressing Transposes</h1>
286290
<pre class="highlight"><code class="language-python">A = pt.tensor([3,3], pt.format([dense, compressed]))
287291
B = pt.tensor([3,3], pt.format([dense, compressed]))
288292
C = pt.tensor([3,3], pt.format([dense, compressed]))
293+
i, j = pt.get_index_vars(2)
289294

290-
A[i,j] = B[i,j] + C[j,i]</code></pre>
295+
A[i,j] = B[i,j] + C[j,i] # ERROR!!</code></pre>
291296

292297
<p>As an alternative, you can first explicitly transpose <code>C</code> by invoking its
293298
<code>transpose</code> method, storing the result in a temporary, and then perform the
294299
addition with the already-transposed temporary:</p>
295300
<pre class="highlight"><code class="language-python">A = pt.tensor([3,3], pt.format([dense, compressed]))
296301
B = pt.tensor([3,3], pt.format([dense, compressed]))
297302
C = pt.tensor([3,3], pt.format([dense, compressed]))
303+
i, j = pt.get_index_vars(2)
298304

299305
Ct = C.transpose([1, 0]) # Ct is also stored in the CSR format
300306
A[i,j] = B[i,j] + Ct[i,j]</code></pre>
@@ -306,15 +312,17 @@ <h1 id="expressing-transposes">Expressing Transposes</h1>
306312
<pre class="highlight"><code class="language-python">A = pt.tensor([3,3], pt.format([dense, compressed]))
307313
B = pt.tensor([3,3], pt.format([dense, compressed]))
308314
C = pt.tensor([3,3], pt.format([dense, compressed], [1, 0]))
315+
i, j = pt.get_index_vars(2)
309316

310-
A[i,j] = B[i,j] + C[i,j]</code></pre>
317+
A[i,j] = B[i,j] + C[i,j] # ERROR!!</code></pre>
311318

312319
<p>We can again perform the same computation by invoking <code>transpose</code>, this time to
313320
repack <code>C</code> into the same CSR format as <code>A</code> and <code>B</code> before computing the
314321
addition:</p>
315322
<pre class="highlight"><code class="language-python">A = pt.tensor([3,3], pt.format([dense, compressed]))
316323
B = pt.tensor([3,3], pt.format([dense, compressed]))
317324
C = pt.tensor([3,3], pt.format([dense, compressed], [1, 0]))
325+
i, j = pt.get_index_vars(2)
318326

319327
Cp = C.transpose([0, 1], pt.format([dense, compressed])) # Store a copy of C in the CSR format
320328
A[i,j] = B[i,j] + Cp[i,j]</code></pre>

sdh-docs/pytensors/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ <h1 id="defining-tensor-formats">Defining Tensor Formats</h1>
216216
<code>pytaco.format</code> object. This requires specifying whether each tensor dimension
217217
is dense or sparse as well as (optionally) the order in which dimensions should
218218
be stored. TACO also predefines some common tensor formats (including
219-
<code>pt.csr</code>, <code>pt.csc</code> and <code>pt.csf</code>) that you can use out of the box.</p>
219+
<code>pt.csr</code> and <code>pt.csc</code>) that you can use out of the box.</p>
220220
<h1 id="initializing-tensors">Initializing Tensors</h1>
221221
<p>Tensors can be made by using python indexing syntax. For example, one may write
222222
the following: You can initialize a tensor by calling its <code>insert</code> method to
@@ -247,8 +247,8 @@ <h1 id="initializing-tensors">Initializing Tensors</h1>
247247
<pre class="highlight"><code class="language-python">A.pack()</code></pre>
248248

249249
<p>You can then iterate over the nonzero elements of the tensor as follows:</p>
250-
<pre class="highlight"><code class="language-python">for elem in A:
251-
print(elem)</code></pre>
250+
<pre class="highlight"><code class="language-python">for coordinates, val in A:
251+
print(val)</code></pre>
252252

253253
<h1 id="file-io">File I/O</h1>
254254
<p>Rather than manually constructing a tensor, you can load tensors directly from

0 commit comments

Comments
 (0)