mirror of
https://github.com/ml-explore/mlx.git
synced 2025-06-26 02:33:21 +08:00
157 lines
8.3 KiB
HTML
157 lines
8.3 KiB
HTML
<!DOCTYPE html>
|
|
<html class="writer-html5" lang="en" >
|
|
<head>
|
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Using Streams — MLX 0.0.0 documentation</title>
|
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
|
<!--[if lt IE 9]>
|
|
<script src="_static/js/html5shiv.min.js"></script>
|
|
<![endif]-->
|
|
|
|
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
|
<script src="_static/jquery.js"></script>
|
|
<script src="_static/underscore.js"></script>
|
|
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
|
<script src="_static/doctools.js"></script>
|
|
<script src="_static/js/theme.js"></script>
|
|
<link rel="index" title="Index" href="genindex.html" />
|
|
<link rel="search" title="Search" href="search.html" />
|
|
<link rel="next" title="Linear Regression" href="examples/linear_regression.html" />
|
|
<link rel="prev" title="Quick Start Guide" href="quick_start.html" />
|
|
</head>
|
|
|
|
<body class="wy-body-for-nav">
|
|
<div class="wy-grid-for-nav">
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
<div class="wy-side-scroll">
|
|
<div class="wy-side-nav-search" >
|
|
|
|
|
|
|
|
<a href="index.html" class="icon icon-home">
|
|
MLX
|
|
</a>
|
|
<div class="version">
|
|
0.0.0
|
|
</div>
|
|
<div role="search">
|
|
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
</div>
|
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
|
<p class="caption" role="heading"><span class="caption-text">Install</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="install.html">Build and Install</a></li>
|
|
</ul>
|
|
<p class="caption" role="heading"><span class="caption-text">Usage</span></p>
|
|
<ul class="current">
|
|
<li class="toctree-l1"><a class="reference internal" href="quick_start.html">Quick Start Guide</a></li>
|
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Using Streams</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="#specifying-the-stream">Specifying the <code class="xref py py-obj docutils literal notranslate"><span class="pre">Stream</span></code></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<p class="caption" role="heading"><span class="caption-text">Examples</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="examples/linear_regression.html">Linear Regression</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="examples/mlp.html">Multi-Layer Perceptron</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="examples/llama-inference.html">LLM inference</a></li>
|
|
</ul>
|
|
<p class="caption" role="heading"><span class="caption-text">Further Reading</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="dev/extensions.html">Developer Documentation</a></li>
|
|
</ul>
|
|
<p class="caption" role="heading"><span class="caption-text">Python API Reference</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="python/array.html">Array</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="python/devices_and_streams.html">Devices and Streams</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="python/ops.html">Operations</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="python/random.html">Random</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="python/transforms.html">Transforms</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="python/fft.html">FFT</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="python/nn.html">Neural Networks</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="python/optimizers.html">Optimizers</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="python/tree_utils.html">Tree Utils</a></li>
|
|
</ul>
|
|
<p class="caption" role="heading"><span class="caption-text">C++ API Reference</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="cpp/ops.html">Operations</a></li>
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
<a href="index.html">MLX</a>
|
|
</nav>
|
|
|
|
<div class="wy-nav-content">
|
|
<div class="rst-content">
|
|
<div role="navigation" aria-label="Page navigation">
|
|
<ul class="wy-breadcrumbs">
|
|
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
|
|
<li class="breadcrumb-item active">Using Streams</li>
|
|
<li class="wy-breadcrumbs-aside">
|
|
<a href="_sources/using_streams.rst.txt" rel="nofollow"> View page source</a>
|
|
</li>
|
|
</ul>
|
|
<hr/>
|
|
</div>
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
<div itemprop="articleBody">
|
|
|
|
<section id="using-streams">
|
|
<h1>Using Streams<a class="headerlink" href="#using-streams" title="Permalink to this heading"></a></h1>
|
|
<section id="specifying-the-stream">
|
|
<h2>Specifying the <a class="reference internal" href="python/_autosummary/mlx.core.Stream.html#mlx.core.Stream" title="mlx.core.Stream"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Stream</span></code></a><a class="headerlink" href="#specifying-the-stream" title="Permalink to this heading"></a></h2>
|
|
<p>All operations (including random number generation) take an optional
|
|
keyword argument <code class="docutils literal notranslate"><span class="pre">stream</span></code>. The <code class="docutils literal notranslate"><span class="pre">stream</span></code> kwarg specifies which
|
|
<a class="reference internal" href="python/_autosummary/mlx.core.Stream.html#mlx.core.Stream" title="mlx.core.Stream"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Stream</span></code></a> the operation should run on. If the stream is unspecified then
|
|
the operation is run on the default stream of the default device:
|
|
<code class="docutils literal notranslate"><span class="pre">mx.default_stream(mx.default_device())</span></code>. The <code class="docutils literal notranslate"><span class="pre">stream</span></code> kwarg can also
|
|
be a <a class="reference internal" href="python/_autosummary/mlx.core.Device.html#mlx.core.Device" title="mlx.core.Device"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Device</span></code></a> (e.g. <code class="docutils literal notranslate"><span class="pre">stream=my_device</span></code>) in which case the operation is
|
|
run on the default stream of the provided device
|
|
<code class="docutils literal notranslate"><span class="pre">mx.default_stream(my_device)</span></code>.</p>
|
|
</section>
|
|
</section>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
|
<a href="quick_start.html" class="btn btn-neutral float-left" title="Quick Start Guide" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
|
<a href="examples/linear_regression.html" class="btn btn-neutral float-right" title="Linear Regression" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<p>© Copyright 2023, MLX Contributors.</p>
|
|
</div>
|
|
|
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
|
|
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<script>
|
|
jQuery(function () {
|
|
SphinxRtdTheme.Navigation.enable(true);
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html> |