forked from arrayfire/arrayfire-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrayfire.blas.html
More file actions
304 lines (261 loc) · 15.3 KB
/
arrayfire.blas.html
File metadata and controls
304 lines (261 loc) · 15.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>arrayfire.blas module — ArrayFire Python documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
<link rel="stylesheet" href="_static/style.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-arrayfire.blas">
<span id="arrayfire-blas-module"></span><h1>arrayfire.blas module<a class="headerlink" href="#module-arrayfire.blas" title="Permalink to this headline">¶</a></h1>
<p>BLAS functions (matmul, dot, etc)</p>
<dl class="py function">
<dt id="arrayfire.blas.dot">
<code class="sig-prename descclassname"><span class="pre">arrayfire.blas.</span></code><code class="sig-name descname"><span class="pre">dot</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="pre">lhs</span></em>, <em class="sig-param"><span class="pre">rhs</span></em>, <em class="sig-param"><span class="pre">lhs_opts=<MATPROP.NONE:</span> <span class="pre">0></span></em>, <em class="sig-param"><span class="pre">rhs_opts=<MATPROP.NONE:</span> <span class="pre">0></span></em>, <em class="sig-param"><span class="pre">return_scalar=False</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/arrayfire/blas.html#dot"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#arrayfire.blas.dot" title="Permalink to this definition">¶</a></dt>
<dd><p>Dot product of two input vectors.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>lhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 1 dimensional, real or complex arrayfire array.</p>
</dd>
<dt><strong>rhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 1 dimensional, real or complex arrayfire array.</p>
</dd>
<dt><strong>lhs_opts: optional: af.MATPROP. default: af.MATPROP.NONE.</strong></dt><dd><dl class="simple">
<dt>Can be one of</dt><dd><ul class="simple">
<li><p>af.MATPROP.NONE - If no op should be done on <cite>lhs</cite>.</p></li>
<li><p>No other options are currently supported.</p></li>
</ul>
</dd>
</dl>
</dd>
<dt><strong>rhs_opts: optional: af.MATPROP. default: af.MATPROP.NONE.</strong></dt><dd><dl class="simple">
<dt>Can be one of</dt><dd><ul class="simple">
<li><p>af.MATPROP.NONE - If no op should be done on <cite>rhs</cite>.</p></li>
<li><p>No other options are currently supported.</p></li>
</ul>
</dd>
</dl>
</dd>
<dt><strong>return_scalar: optional: bool. default: False.</strong></dt><dd><ul class="simple">
<li><p>When set to true, the input arrays are flattened and the output is a scalar</p></li>
</ul>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>out</strong><span class="classifier">af.Array or scalar</span></dt><dd><p>Output of dot product of <cite>lhs</cite> and <cite>rhs</cite>.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt id="arrayfire.blas.gemm">
<code class="sig-prename descclassname"><span class="pre">arrayfire.blas.</span></code><code class="sig-name descname"><span class="pre">gemm</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="pre">lhs</span></em>, <em class="sig-param"><span class="pre">rhs</span></em>, <em class="sig-param"><span class="pre">alpha=1.0</span></em>, <em class="sig-param"><span class="pre">beta=0.0</span></em>, <em class="sig-param"><span class="pre">lhs_opts=<MATPROP.NONE:</span> <span class="pre">0></span></em>, <em class="sig-param"><span class="pre">rhs_opts=<MATPROP.NONE:</span> <span class="pre">0></span></em>, <em class="sig-param"><span class="pre">C=None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/arrayfire/blas.html#gemm"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#arrayfire.blas.gemm" title="Permalink to this definition">¶</a></dt>
<dd><p>BLAS general matrix multiply (GEMM) of two af_array objects.</p>
<p>This provides a general interface to the BLAS level 3 general matrix multiply (GEMM), which is generally defined as:</p>
<p>C = alpha * opA(A) opB(B) + beta * C</p>
<p>where alpha and beta are both scalars; A and B are the matrix multiply operands;
and opA and opB are noop (if AF_MAT_NONE) or transpose (if AF_MAT_TRANS) operations
on A or B before the actual GEMM operation.
Batched GEMM is supported if at least either A or B have more than two dimensions
(see af::matmul for more details on broadcasting).
However, only one alpha and one beta can be used for all of the batched matrix operands.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>lhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 2 dimensional, real or complex arrayfire array.</p>
</dd>
<dt><strong>rhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 2 dimensional, real or complex arrayfire array.</p>
</dd>
<dt><strong>alpha</strong><span class="classifier">scalar</span></dt><dd></dd>
<dt><strong>beta</strong><span class="classifier">scalar</span></dt><dd></dd>
<dt><strong>lhs_opts: optional: af.MATPROP. default: af.MATPROP.NONE.</strong></dt><dd><dl class="simple">
<dt>Can be one of</dt><dd><ul class="simple">
<li><p>af.MATPROP.NONE - If no op should be done on <cite>lhs</cite>.</p></li>
<li><p>af.MATPROP.TRANS - If <cite>lhs</cite> has to be transposed before multiplying.</p></li>
<li><p>af.MATPROP.CTRANS - If <cite>lhs</cite> has to be hermitian transposed before multiplying.</p></li>
</ul>
</dd>
</dl>
</dd>
<dt><strong>rhs_opts: optional: af.MATPROP. default: af.MATPROP.NONE.</strong></dt><dd><dl class="simple">
<dt>Can be one of</dt><dd><ul class="simple">
<li><p>af.MATPROP.NONE - If no op should be done on <cite>rhs</cite>.</p></li>
<li><p>af.MATPROP.TRANS - If <cite>rhs</cite> has to be transposed before multiplying.</p></li>
<li><p>af.MATPROP.CTRANS - If <cite>rhs</cite> has to be hermitian transposed before multiplying.</p></li>
</ul>
</dd>
</dl>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>out</strong><span class="classifier">af.Array</span></dt><dd><p>Output of the matrix multiplication on <cite>lhs</cite> and <cite>rhs</cite>.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt id="arrayfire.blas.matmul">
<code class="sig-prename descclassname"><span class="pre">arrayfire.blas.</span></code><code class="sig-name descname"><span class="pre">matmul</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="pre">lhs</span></em>, <em class="sig-param"><span class="pre">rhs</span></em>, <em class="sig-param"><span class="pre">lhs_opts=<MATPROP.NONE:</span> <span class="pre">0></span></em>, <em class="sig-param"><span class="pre">rhs_opts=<MATPROP.NONE:</span> <span class="pre">0></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/arrayfire/blas.html#matmul"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#arrayfire.blas.matmul" title="Permalink to this definition">¶</a></dt>
<dd><p>Generalized matrix multiplication for two matrices.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>lhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 2 dimensional, real or complex arrayfire array.</p>
</dd>
<dt><strong>rhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 2 dimensional, real or complex arrayfire array.</p>
</dd>
<dt><strong>lhs_opts: optional: af.MATPROP. default: af.MATPROP.NONE.</strong></dt><dd><dl class="simple">
<dt>Can be one of</dt><dd><ul class="simple">
<li><p>af.MATPROP.NONE - If no op should be done on <cite>lhs</cite>.</p></li>
<li><p>af.MATPROP.TRANS - If <cite>lhs</cite> has to be transposed before multiplying.</p></li>
<li><p>af.MATPROP.CTRANS - If <cite>lhs</cite> has to be hermitian transposed before multiplying.</p></li>
</ul>
</dd>
</dl>
</dd>
<dt><strong>rhs_opts: optional: af.MATPROP. default: af.MATPROP.NONE.</strong></dt><dd><dl class="simple">
<dt>Can be one of</dt><dd><ul class="simple">
<li><p>af.MATPROP.NONE - If no op should be done on <cite>rhs</cite>.</p></li>
<li><p>af.MATPROP.TRANS - If <cite>rhs</cite> has to be transposed before multiplying.</p></li>
<li><p>af.MATPROP.CTRANS - If <cite>rhs</cite> has to be hermitian transposed before multiplying.</p></li>
</ul>
</dd>
</dl>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>out</strong><span class="classifier">af.Array</span></dt><dd><p>Output of the matrix multiplication on <cite>lhs</cite> and <cite>rhs</cite>.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt id="arrayfire.blas.matmulNT">
<code class="sig-prename descclassname"><span class="pre">arrayfire.blas.</span></code><code class="sig-name descname"><span class="pre">matmulNT</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rhs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/arrayfire/blas.html#matmulNT"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#arrayfire.blas.matmulNT" title="Permalink to this definition">¶</a></dt>
<dd><p>Matrix multiplication after transposing the second matrix.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>lhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 2 dimensional, real or complex arrayfire array.</p>
</dd>
<dt><strong>rhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 2 dimensional, real or complex arrayfire array.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>out</strong><span class="classifier">af.Array</span></dt><dd><p>Output of the matrix multiplication on <cite>lhs</cite> and <cite>transpose(rhs)</cite>.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt id="arrayfire.blas.matmulTN">
<code class="sig-prename descclassname"><span class="pre">arrayfire.blas.</span></code><code class="sig-name descname"><span class="pre">matmulTN</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rhs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/arrayfire/blas.html#matmulTN"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#arrayfire.blas.matmulTN" title="Permalink to this definition">¶</a></dt>
<dd><p>Matrix multiplication after transposing the first matrix.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>lhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 2 dimensional, real or complex arrayfire array.</p>
</dd>
<dt><strong>rhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 2 dimensional, real or complex arrayfire array.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>out</strong><span class="classifier">af.Array</span></dt><dd><p>Output of the matrix multiplication on <cite>transpose(lhs)</cite> and <cite>rhs</cite>.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt id="arrayfire.blas.matmulTT">
<code class="sig-prename descclassname"><span class="pre">arrayfire.blas.</span></code><code class="sig-name descname"><span class="pre">matmulTT</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rhs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/arrayfire/blas.html#matmulTT"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#arrayfire.blas.matmulTT" title="Permalink to this definition">¶</a></dt>
<dd><p>Matrix multiplication after transposing both inputs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>lhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 2 dimensional, real or complex arrayfire array.</p>
</dd>
<dt><strong>rhs</strong><span class="classifier">af.Array</span></dt><dd><p>A 2 dimensional, real or complex arrayfire array.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>out</strong><span class="classifier">af.Array</span></dt><dd><p>Output of the matrix multiplication on <cite>transpose(lhs)</cite> and <cite>transpose(rhs)</cite>.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/arrayfire_logo_symbol.png" alt="Logo"/>
</a></p>
<h1 class="logo"><a href="index.html">ArrayFire</a></h1>
<h3>Navigation</h3>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©2020, ArrayFire.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 3.5.1</a>
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/arrayfire.blas.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>