-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.html
295 lines (276 loc) · 25.2 KB
/
install.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Installing
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Atılım Güneş Baydin, Don Syme, Barak A. Pearlmutter, Jeffrey Siskind, and DiffSharp contributors">
<meta name="description" content="DiffSharp is a tensor library with support for differentiable programming. It is designed for use in machine learning, probabilistic programming, optimization and other domains.">
<script src="https://code.jquery.com/jquery-1.8.0.js"></script>
<script src="https://code.jquery.com/ui/1.8.23/jquery-ui.js"></script>
<script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="https://diffsharp.github.io/content/fsdocs-default.css" />
<script src="https://diffsharp.github.io/content/fsdocs-tips.js" type="text/javascript"></script>
<!-- BEGIN SEARCH BOX: this adds support for the search box -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/JavaScript-autoComplete/1.0.4/auto-complete.css" />
<!-- END SEARCH BOX: this adds support for the search box -->
</head>
<body>
<div class="container">
<!-- <div class="masthead">
<ul class="nav nav-pills pull-right">
<li><a href="https://fsharp.org">fsharp.org</a></li>
</ul>
<h3 class="muted">DiffSharp</h3>
</div> -->
<!-- <hr /> -->
<div class="row">
<div class="col-xs-12" style="height:10px;"></div>
</div>
<div class="row">
<div class="span3" id="fsdocs-nav">
<a href="index.html"><img class="logo" src="https://diffsharp.github.io/img/diffsharp-logo-text.png"/></a>
<!-- BEGIN SEARCH BOX: this adds support for the search box -->
<div id="header">
<div class="searchbox">
<label for="search-by">
<i class="fas fa-search"></i>
</label>
<input data-search-input="" id="search-by" type="search" placeholder="Search..." />
<span data-search-clear="">
<i class="fas fa-times"></i>
</span>
</div>
</div>
<!-- END SEARCH BOX: this adds support for the search box -->
<ul class="nav nav-list" id="menu">
<!-- <li class="nav-header">DiffSharp</li> -->
<!-- <li class="divider"></li> -->
<li><a href="https://diffsharp.github.io/index.html">Home</a></li>
<li><a href="https://github.com/DiffSharp/DiffSharp/">GitHub</a></li>
<li><a href="https://github.com/DiffSharp/DiffSharp/blob/dev/LICENSE">License (BSD)</a></li>
<li class="nav-header">Getting Started</li>
<!-- <li class="divider"></li> -->
<li><a href="https://diffsharp.github.io/install.html">Install</a></li>
<li><a href="https://diffsharp.github.io/quickstart.html">Quickstart</a></li>
<!-- <li><a href="https://diffsharp.github.io/tensors.html">Tensors</a></li> -->
<!-- <li><a href="https://diffsharp.github.io/differentiable-programming.html">Differentiable Programming</a></li> -->
<!-- <li><a href="https://diffsharp.github.io/nested-derivatives.html">Nested Derivatives</a></li> -->
<!-- <li><a href="https://diffsharp.github.io/models.html">Models</a></li> -->
<!-- <li><a href="https://diffsharp.github.io/optimization.html">Optimization</a></li> -->
<!-- <li><a href="https://diffsharp.github.io/probability-distributions.html">Probability Distributions</a></li> -->
<li class="nav-header">Tutorials</li>
<!-- <li class="divider"></li> -->
<!-- <li><a href="https://diffsharp.github.io/tutorial-classifier.html">Classifier</a></li> -->
<!-- <li><a href="https://diffsharp.github.io/tutorial-gan.html">GAN</a></li> -->
<!-- <li><a href="https://diffsharp.github.io/tutorial-vae.html">VAE</a></li> -->
<!-- <li><a href="https://diffsharp.github.io/tutorial-language.html">Language Models</a></li> -->
<li><a href="https://github.com/DiffSharp/DiffSharp/tree/dev/examples">More Examples</a></li>
<li class="nav-header">API Documentation</li>
<li><a href="https://diffsharp.github.io/reference/index.html">API Reference</a></li>
<li><a href="https://diffsharp.github.io/extensions.html">Extensions</a></li>
<!-- <li class="nav-header">Examples</li> -->
<!-- <li class="divider"></li> -->
<!-- <li class="nav-header">Machine Learning</li> -->
<!-- <li><a href="https://diffsharp.github.io/examples-topic1.html">Topic 1</a></li> -->
<!-- <li class="divider"></li>
<li class="nav-header">Authors</li>
<li><a href="http://www.robots.ox.ac.uk/~gunes/">Atılım Güneş Baydin</a></li>
<li><a href="http://www.bcl.hamilton.ie/~barak/">Barak A. Pearlmutter</a></li>
<li><a href="https://www.microsoft.com/en-us/research/people/dsyme/">Don Syme</a></li> -->
</ul>
</div>
<div class="span9" id="fsdocs-content">
<p><a href="https://colab.research.google.com/github/DiffSharp/diffsharp.github.io/blob/master/install.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Binder" /></a> 
<a href="https://mybinder.org/v2/gh/diffsharp/diffsharp.github.io/master?filepath=install.ipynb"><img src="img/badge-binder.svg" alt="Binder" /></a> 
<a href="install.fsx"><img src="img/badge-script.svg" alt="Script" /></a> 
<a href="install.ipynb"><img src="img/badge-notebook.svg" alt="Script" /></a></p>
<h1><a name="Installing" class="anchor" href="#Installing">Installing</a></h1>
<p>DiffSharp runs on <a href="https://dotnet.microsoft.com/">dotnet</a>, a cross-platform, open-source platform supported on Linux, macOS, and Windows.</p>
<p>There are various ways in which you can run DiffSharp, the main ones being: <a href="https://github.com/dotnet/interactive">interactive notebooks</a> supporting <a href="https://code.visualstudio.com/">Visual Studio Code</a> and <a href="https://jupyter.org/">Jupyter</a>; running in a <a href="https://github.com/jonsequitur/dotnet-repl">REPL</a>; running <a href="https://docs.microsoft.com/en-us/dotnet/fsharp/tools/fsharp-interactive/">script files</a>; and <a href="https://docs.microsoft.com/en-us/dotnet/core/introduction">compiling, packing, and publishing</a> performant binaries.</p>
<h2><a name="Interactive-Notebooks-and-Scripts" class="anchor" href="#Interactive-Notebooks-and-Scripts">Interactive Notebooks and Scripts</a></h2>
<p>You can use DiffSharp in <a href="https://github.com/dotnet/interactive">dotnet interactive</a> notebooks in <a href="https://code.visualstudio.com/">Visual Studio Code</a> or <a href="https://jupyter.org/">Jupyter</a>, or in F# scripts (<code>.fsx</code> files), by referencing the package as follows:</p>
<pre class="fssnip highlighted"><code lang="fsharp"><span class="c">// Use one of the following three lines</span>
<span class="pp">#r</span> <span class="s">"nuget: DiffSharp-cpu"</span> <span class="c">// Use the latest version</span>
<span class="pp">#r</span> <span class="s">"nuget: DiffSharp-cpu, *-*"</span> <span class="c">// Use the latest pre-release version</span>
<span class="pp">#r</span> <span class="s">"nuget: DiffSharp-cpu, 1.0.1"</span> <span class="c">// Use a specific version</span>
<span class="k">open</span> <span onmouseout="hideTip(event, 'fs1', 10)" onmouseover="showTip(event, 'fs1', 10)" class="id">DiffSharp</span>
</code></pre>
</br>
<img src="img/anim-intro-1.gif" width="85%" />
<h2><a name="Dotnet-Applications" class="anchor" href="#Dotnet-Applications">Dotnet Applications</a></h2>
<p>You can add DiffSharp to your dotnet application using the <a href="https://dotnet.microsoft.com/">dotnet</a> command-line interface (CLI).</p>
<p>For example, the following creates a new F# console application and adds the latest pre-release version of the <code>DiffSharp-cpu</code> package as a dependency.</p>
<pre class="fssnip highlighted"><code lang="fsharp"><span class="id">dotnet</span> <span class="k">new</span> <span class="id">console</span> <span class="o">-</span><span class="id">lang</span> <span class="s">"F#"</span> <span class="o">-</span><span class="id">o</span> <span class="id">src</span><span class="o">/</span><span class="id">app</span>
<span class="id">cd</span> <span class="id">src</span><span class="o">/</span><span class="id">app</span>
<span class="id">dotnet</span> <span class="id">add</span> <span class="id">package</span> <span class="o">--</span><span class="id">prerelease</span> <span onmouseout="hideTip(event, 'fs1', 11)" onmouseover="showTip(event, 'fs1', 11)" class="id">DiffSharp</span><span class="o">-</span><span class="id">cpu</span>
<span class="id">dotnet</span> <span class="id">run</span>
</code></pre>
<h2><a name="Packages" class="anchor" href="#Packages">Packages</a></h2>
<p>We provide several package bundles for a variety of use cases.</p>
<ul>
<li>
<a href="https://www.nuget.org/packages/DiffSharp-cpu">DiffSharp-cpu</a></br>
Includes LibTorch CPU binaries for Linux, macOS, and Windows.
</li>
<li>
<a href="https://www.nuget.org/packages/DiffSharp-cuda-linux">DiffSharp-cuda-linux</a> / <a href="https://www.nuget.org/packages/DiffSharp-cuda-windows">DiffSharp-cuda-windows</a></br>
Include LibTorch CPU and CUDA GPU binaries for Linux and Windows. Large download.
</li>
<li>
<a href="https://www.nuget.org/packages/DiffSharp-lite">DiffSharp-lite</a></br>
Includes the Torch backend but not the LibTorch binaries.
</li>
</ul>
<h3><a name="Using-local-LibTorch-binaries-optional" class="anchor" href="#Using-local-LibTorch-binaries-optional">Using local LibTorch binaries (optional)</a></h3>
<p>You can combine the <code>DiffSharp-lite</code> package bundle with existing local native binaries of LibTorch for your OS (Linux, Mac, or Windows) installed through other means.</p>
<p>LibTorch is the main tensor computation core implemented in C++/CUDA and it is used by PyTorch in Python and by other projects in various programming languages. The following are two common ways of having LibTorch in your system.</p>
<ul>
<li>If you use Python and have <a href="https://pytorch.org/">PyTorch</a> installed, this comes with LibTorch as a part of the PyTorch distribution. If your GPU works in this PyTorch installation without any issues, it will also work in DiffSharp.</li>
<li>You can download the native LibTorch package without Python by following the <a href="https://pytorch.org/get-started/locally/">get started</a> instructions in the PyTorch website, and extracting the downloaded archive to a folder in your system.</li>
</ul>
<p>Before using the <code>Torch</code> backend in DiffSharp, you will have to add an explicit load of the LibTorch native library, which you can do as follows. In order to find the location of LibTorch binaries, searching for <code>libtorch.so</code> in your system might be helpful. Note that this file is called <code>libtorch.so</code> in Linux, <code>libtorch.dylib</code> in macOS, and <code>torch.dll</code> in Windows.</p>
<pre class="fssnip highlighted"><code lang="fsharp"><span class="k">open</span> <span onmouseout="hideTip(event, 'fs7', 12)" onmouseover="showTip(event, 'fs7', 12)" class="id">System</span><span class="pn">.</span><span onmouseout="hideTip(event, 'fs8', 13)" onmouseover="showTip(event, 'fs8', 13)" class="id">Runtime</span><span class="pn">.</span><span onmouseout="hideTip(event, 'fs9', 14)" onmouseover="showTip(event, 'fs9', 14)" class="id">InteropServices</span>
<span class="id">NativeLibrary</span><span class="pn">.</span><span class="id">Load</span><span class="pn">(</span><span class="s">"/home/user/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch.so"</span><span class="pn">)</span>
</code></pre>
<h2><a name="Backends-and-Devices" class="anchor" href="#Backends-and-Devices">Backends and Devices</a></h2>
<p>DiffSharp currently provides two computation backends.</p>
<ul>
<li><p>The <code>Torch</code> backend is the default and recommended backend based on <a href="https://pytorch.org/cppdocs/">LibTorch</a>, using the same C++ and CUDA implementations for tensor computations that power <a href="https://pytorch.org/">PyTorch</a>. On top of these raw tensors (LibTorch's ATen, excluding autograd), DiffSharp implements its own computation graph and differentiation capabilities. This backend requires platform-specific binaries of LibTorch, which we provide and test on Linux, macOS, and Windows.</p></li>
<li><p>The <code>Reference</code> backend is implemented purely in F# and can run on any hardware platform where <a href="https://dotnet.microsoft.com/">dotnet</a> can run (for example iOS, Android, Raspberry Pi). This backend has reasonable performance for use cases dominated by scalar and small tensor operations, and is not recommended for use cases involving large tensor operations (such as machine learning). This backend is always available.</p></li>
</ul>
<h3><a name="Configuration-of-Default-Backend-Device-and-Tensor-Type" class="anchor" href="#Configuration-of-Default-Backend-Device-and-Tensor-Type">Configuration of Default Backend, Device, and Tensor Type</a></h3>
<p>Selection of the default backend, device, and tensor type is done using <a href="https://diffsharp.github.io/reference/diffsharp-dsharp.html#config">dsharp.config</a>.</p>
<ul>
<li><p><a href="https://diffsharp.github.io/reference/diffsharp-dtype.html">Dtype</a> choices available: <code>BFloat16</code>, <code>Bool</code>, <code>Byte</code>, <code>Float16</code>, <code>Float32</code>, <code>Float64</code>, <code>Int16</code>, <code>Int32</code>, <code>Int64</code>, <code>Int8</code></p></li>
<li><p><a href="https://diffsharp.github.io/reference/diffsharp-device.html">Device</a> choices available: <code>CPU</code>, <code>GPU</code></p></li>
<li><p><a href="https://diffsharp.github.io/reference/diffsharp-backend.html">Backend</a> choices available: <code>Reference</code>, <code>Torch</code></p></li>
</ul>
<p>For example, the following selects the <code>Torch</code> backend with single precision tensors as the default tensor type and GPU (CUDA) execution.</p>
<pre class="fssnip highlighted"><code lang="fsharp"><span class="k">open</span> <span onmouseout="hideTip(event, 'fs1', 15)" onmouseover="showTip(event, 'fs1', 15)" class="id">DiffSharp</span>
<span onmouseout="hideTip(event, 'fs2', 16)" onmouseover="showTip(event, 'fs2', 16)" class="rt">dsharp</span><span class="pn">.</span><span onmouseout="hideTip(event, 'fs10', 17)" onmouseover="showTip(event, 'fs10', 17)" class="id">config</span><span class="pn">(</span><span class="fn">dtype</span><span class="o">=</span><span onmouseout="hideTip(event, 'fs11', 18)" onmouseover="showTip(event, 'fs11', 18)" class="m">Dtype</span><span class="pn">.</span><span onmouseout="hideTip(event, 'fs12', 19)" onmouseover="showTip(event, 'fs12', 19)" class="id">Float32</span><span class="pn">,</span> <span class="fn">device</span><span class="o">=</span><span onmouseout="hideTip(event, 'fs13', 20)" onmouseover="showTip(event, 'fs13', 20)" class="m">Device</span><span class="pn">.</span><span onmouseout="hideTip(event, 'fs14', 21)" onmouseover="showTip(event, 'fs14', 21)" class="id">GPU</span><span class="pn">,</span> <span class="fn">backend</span><span class="o">=</span><span onmouseout="hideTip(event, 'fs4', 22)" onmouseover="showTip(event, 'fs4', 22)" class="m">Backend</span><span class="pn">.</span><span onmouseout="hideTip(event, 'fs15', 23)" onmouseover="showTip(event, 'fs15', 23)" class="id">Torch</span><span class="pn">)</span>
</code></pre>
<p>The following selects the <code>Reference</code> backend.</p>
<pre class="fssnip highlighted"><code lang="fsharp"><span onmouseout="hideTip(event, 'fs2', 24)" onmouseover="showTip(event, 'fs2', 24)" class="rt">dsharp</span><span class="pn">.</span><span onmouseout="hideTip(event, 'fs10', 25)" onmouseover="showTip(event, 'fs10', 25)" class="id">config</span><span class="pn">(</span><span class="fn">backend</span><span class="o">=</span><span onmouseout="hideTip(event, 'fs4', 26)" onmouseover="showTip(event, 'fs4', 26)" class="m">Backend</span><span class="pn">.</span><span onmouseout="hideTip(event, 'fs16', 27)" onmouseover="showTip(event, 'fs16', 27)" class="id">Reference</span><span class="pn">)</span>
</code></pre>
<p>A tensor's backend and device can be inspected as follows.</p>
<pre class="fssnip highlighted"><code lang="fsharp"><span class="k">let</span> <span onmouseout="hideTip(event, 'fs17', 28)" onmouseover="showTip(event, 'fs17', 28)" class="id">t</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fs2', 29)" onmouseover="showTip(event, 'fs2', 29)" class="rt">dsharp</span><span class="pn">.</span><span onmouseout="hideTip(event, 'fs18', 30)" onmouseover="showTip(event, 'fs18', 30)" class="id">tensor</span> <span class="pn">[</span> <span class="n">0</span> <span class="o">..</span> <span class="n">10</span> <span class="pn">]</span>
<span class="k">let</span> <span onmouseout="hideTip(event, 'fs19', 31)" onmouseover="showTip(event, 'fs19', 31)" class="id">device</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fs17', 32)" onmouseover="showTip(event, 'fs17', 32)" class="id">t</span><span class="pn">.</span><span class="id">device</span>
<span class="k">let</span> <span onmouseout="hideTip(event, 'fs20', 33)" onmouseover="showTip(event, 'fs20', 33)" class="id">backend</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fs17', 34)" onmouseover="showTip(event, 'fs17', 34)" class="id">t</span><span class="pn">.</span><span class="id">backend</span>
</code></pre>
<p>Tensors can be moved between devices (for example from CPU to GPU) using <a href="https://diffsharp.github.io/reference/diffsharp-tensor.html#move">Tensor.move</a>. For example:</p>
<pre class="fssnip highlighted"><code lang="fsharp"><span class="k">let</span> <span onmouseout="hideTip(event, 'fs21', 35)" onmouseover="showTip(event, 'fs21', 35)" class="id">t2</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fs17', 36)" onmouseover="showTip(event, 'fs17', 36)" class="id">t</span><span class="pn">.</span><span class="id">move</span><span class="pn">(</span><span onmouseout="hideTip(event, 'fs13', 37)" onmouseover="showTip(event, 'fs13', 37)" class="m">Device</span><span class="pn">.</span><span onmouseout="hideTip(event, 'fs14', 38)" onmouseover="showTip(event, 'fs14', 38)" class="id">GPU</span><span class="pn">)</span>
</code></pre>
<h2><a name="Developing-DiffSharp-Libraries" class="anchor" href="#Developing-DiffSharp-Libraries">Developing DiffSharp Libraries</a></h2>
<p>To develop libraries built on DiffSharp, you can use the following guideline to reference the various packages.</p>
<ul>
<li>Reference <code>DiffSharp.Core</code> and <code>DiffSharp.Data</code> in your library code.</li>
<li>Reference <code>DiffSharp.Backends.Reference</code> in your correctness testing code.</li>
<li>Reference <code>DiffSharp.Backends.Torch</code> and <code>libtorch-cpu</code> in your CPU testing code.</li>
<li>Reference <code>DiffSharp.Backends.Torch</code> and <code>libtorch-cuda-linux</code> or <code>libtorch-cuda-windows</code> in your (optional) GPU testing code.</li>
</ul>
<div class="fsdocs-tip" id="fs1">namespace DiffSharp</div>
<div class="fsdocs-tip" id="fs2">type dsharp =
static member abs: input: Tensor -> Tensor
static member acos: input: Tensor -> Tensor
static member add: a: Tensor * b: Tensor -> Tensor
static member arange: endVal: float * ?startVal: float * ?step: float * ?device: Device * ?dtype: Dtype * ?backend: Backend -> Tensor + 1 overload
static member arangeLike: input: Tensor * endVal: float * ?startVal: float * ?step: float * ?device: Device * ?dtype: Dtype * ?backend: Backend -> Tensor + 1 overload
static member argmax: input: Tensor -> int[] + 1 overload
static member argmin: input: Tensor -> int[] + 1 overload
static member asin: input: Tensor -> Tensor
static member atan: input: Tensor -> Tensor
static member backends: unit -> Backend list
...<br /><em><summary>
Tensor operations
</summary></em></div>
<div class="fsdocs-tip" id="fs3">static member DiffSharp.dsharp.config: unit -> DiffSharp.Device * DiffSharp.Dtype * DiffSharp.Backend * DiffSharp.Printer<br />static member DiffSharp.dsharp.config: configuration: (DiffSharp.Device * DiffSharp.Dtype * DiffSharp.Backend * DiffSharp.Printer) -> unit<br />static member DiffSharp.dsharp.config: ?device: DiffSharp.Device * ?dtype: DiffSharp.Dtype * ?backend: DiffSharp.Backend * ?printer: DiffSharp.Printer -> unit</div>
<div class="fsdocs-tip" id="fs4">Multiple items<br />module Backend
from DiffSharp<br /><em><summary>
Contains functions and settings related to backend specifications.
</summary></em><br /><br />--------------------<br />type Backend =
| Reference
| Torch
| Other of name: string * code: int
override ToString: unit -> string
member Name: string<br /><em><summary>
Represents a backend for DiffSharp tensors
</summary></em></div>
<div class="fsdocs-tip" id="fs5">union case DiffSharp.Backend.Reference: DiffSharp.Backend<br /><em><summary>
The reference backend
</summary></em></div>
<div class="fsdocs-tip" id="fs6">static member DiffSharp.dsharp.seed: ?seed: int -> unit</div>
<div class="fsdocs-tip" id="fs7">namespace System</div>
<div class="fsdocs-tip" id="fs8">namespace System.Runtime</div>
<div class="fsdocs-tip" id="fs9">namespace System.Runtime.InteropServices</div>
<div class="fsdocs-tip" id="fs10">static member dsharp.config: unit -> Device * Dtype * Backend * Printer<br />static member dsharp.config: configuration: (Device * Dtype * Backend * Printer) -> unit<br />static member dsharp.config: ?device: Device * ?dtype: Dtype * ?backend: Backend * ?printer: Printer -> unit</div>
<div class="fsdocs-tip" id="fs11">Multiple items<br />module Dtype
from DiffSharp<br /><em><summary>
Contains functions and settings related to tensor element types
</summary></em><br /><br />--------------------<br />[<Struct>]
type Dtype =
| BFloat16
| Float16
| Float32
| Float64
| Int8
| Byte
| Int16
| Int32
| Int64
| Bool
override ToString: unit -> string
member SummationType: Dtype<br /><em><summary>
Represents a storage type for elements of a tensor
</summary></em></div>
<div class="fsdocs-tip" id="fs12">union case Dtype.Float32: Dtype<br /><em><summary>
Store elements as 32-bit floating point numbers
</summary></em></div>
<div class="fsdocs-tip" id="fs13">Multiple items<br />union case Device.Device: DeviceType * int -> Device<br /><br />--------------------<br />module Device
from DiffSharp<br /><em><summary>
Contains functions and settings related to device specifications.
</summary></em><br /><br />--------------------<br />[<Struct>]
type Device =
| Device of DeviceType * int
override ToString: unit -> string
member DeviceIndex: int
member DeviceType: DeviceType
static member CPU: Device
static member GPU: Device<br /><em><summary>
Represents a device specification.
</summary></em></div>
<div class="fsdocs-tip" id="fs14">property Device.GPU: Device with get</div>
<div class="fsdocs-tip" id="fs15">union case Backend.Torch: Backend<br /><em><summary>
The LibTorch backend
</summary></em></div>
<div class="fsdocs-tip" id="fs16">union case Backend.Reference: Backend<br /><em><summary>
The reference backend
</summary></em></div>
<div class="fsdocs-tip" id="fs17">val t: Tensor</div>
<div class="fsdocs-tip" id="fs18">static member dsharp.tensor: value: obj * ?device: Device * ?dtype: Dtype * ?backend: Backend -> Tensor</div>
<div class="fsdocs-tip" id="fs19">val device: Device</div>
<div class="fsdocs-tip" id="fs20">val backend: Backend</div>
<div class="fsdocs-tip" id="fs21">val t2: Tensor</div>
</div>
</div>
<div class="row">
<div class="span3"></div>
<div class="span9">
<hr>
<p style="height:50px; display: table-cell; vertical-align: bottom;">© Copyright 2021, DiffSharp Contributors.</p>
<br>
</div>
</div>
</div>
<!-- BEGIN SEARCH BOX: this adds support for the search box -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/JavaScript-autoComplete/1.0.4/auto-complete.css" />
<script type="text/javascript">var fsdocs_search_baseurl = 'https://diffsharp.github.io/'</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lunr.js/2.3.8/lunr.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/JavaScript-autoComplete/1.0.4/auto-complete.min.js"></script>
<script type="text/javascript" src="https://diffsharp.github.io/content/fsdocs-search.js"></script>
<!-- END SEARCH BOX: this adds support for the search box -->
</body>
</html>