-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
Oct 20, 2024
1 parent
4ecd69c
commit 088bcde
Showing
27 changed files
with
55 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"documenter":{"julia_version":"1.6.7","generation_timestamp":"2024-10-20T13:13:48","documenter_version":"1.7.0"}} | ||
{"documenter":{"julia_version":"1.6.7","generation_timestamp":"2024-10-20T15:27:07","documenter_version":"1.7.0"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Buffering · DataAugmentation.jl</title><meta name="title" content="Buffering · DataAugmentation.jl"/><meta property="og:title" content="Buffering · DataAugmentation.jl"/><meta property="twitter:title" content="Buffering · DataAugmentation.jl"/><meta name="description" content="Documentation for DataAugmentation.jl."/><meta property="og:description" content="Documentation for DataAugmentation.jl."/><meta property="twitter:description" content="Documentation for DataAugmentation.jl."/><meta property="og:url" content="https://fluxml.ai/DataAugmentation.jl/stable/buffering/"/><meta property="twitter:url" content="https://fluxml.ai/DataAugmentation.jl/stable/buffering/"/><link rel="canonical" href="https://fluxml.ai/DataAugmentation.jl/stable/buffering/"/><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../search_index.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script><link href="../assets/flux.css" rel="stylesheet" type="text/css"/></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../">DataAugmentation.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../">DataAugmentation.jl</a></li><li><a class="tocitem" href="../quickstart/">Quickstart</a></li><li><a class="tocitem" href="../transformations/">Transformations</a></li><li><span class="tocitem">Build your transformations</span><ul><li><a class="tocitem" href="../iteminterface/">Item Interface</a></li><li><a class="tocitem" href="../tfminterface/">Transform Interface</a></li><li><input class="collapse-toggle" id="menuitem-4-3" type="checkbox"/><label class="tocitem" for="menuitem-4-3"><span class="docs-label">Projective Interface</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../projective/intro/">Intro</a></li><li><a class="tocitem" href="../projective/data/">Data</a></li><li><a class="tocitem" href="../projective/gallery/">Gallery</a></li></ul></li></ul></li><li><span class="tocitem">Misc</span><ul><li class="is-active"><a class="tocitem" href>Buffering</a></li><li><a class="tocitem" href="../preprocessing/">Preprocessing</a></li><li><a class="tocitem" href="../ref/">References</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Misc</a></li><li class="is-active"><a href>Buffering</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Buffering</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/FluxML/DataAugmentation.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/FluxML/DataAugmentation.jl/blob/master/docs/src/buffering.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Buffering"><a class="docs-heading-anchor" href="#Buffering">Buffering</a><a id="Buffering-1"></a><a class="docs-heading-anchor-permalink" href="#Buffering" title="Permalink"></a></h1><p>As mentioned in the section on <a href="../tfminterface/">transformations</a>, you can implement <a href="../ref/#DataAugmentation.apply!"><code>apply!</code></a> as an inplace version of <a href="../ref/#DataAugmentation.apply"><code>apply</code></a> to support buffered transformations. Usually, the result of a regular <code>apply</code> can be used as a buffer. You may write</p><pre><code class="language-julia hljs">buffer = apply(tfm, item) | ||
apply!(buffer, tfm, item)</code></pre><p>However, for some transformations, a different buffer is needed. <a href="../ref/#DataAugmentation.Sequence"><code>Sequence</code></a>, for example, needs to reuse all intermediate results. That is why the buffer creation can be customized:</p><ul><li><a href="../ref/#DataAugmentation.makebuffer"><code>DataAugmentation.makebuffer</code></a><code>(tfm, item)</code> creates a buffer <code>buf</code> that can be used in an <code>apply!</code> call: <code>apply!(buf, tfm, item)</code>.</li></ul><hr/><p>Managing the buffers manually quickly becomes tedious. For convenience, this library implements <a href="../ref/#DataAugmentation.Buffered"><code>DataAugmentation.Buffered</code></a>, a transformation wrapper that will use a buffer internally. <code>btfm = Buffered(tfm)</code> will create a buffer the first time it is <code>apply</code>ed and then use it by internally calling <code>apply!</code>.</p><pre><code class="language-julia hljs">buffered = Buffered(tfm) | ||
buffer = apply(tfm, item) # uses apply! internally</code></pre><p>Since <code>Buffered</code> only stores one buffer, you may run into problems when using it in a multi-threading context where different threads invalidate the buffer before it can be used. In that case, you can use <a href="../ref/#DataAugmentation.BufferedThreadsafe"><code>DataAugmentation.BufferedThreadsafe</code></a>, a version of <code>Buffered</code> that keeps a separate buffer for every thread. </p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="DataAugmentation.Buffered-buffering" href="#DataAugmentation.Buffered-buffering"><code>DataAugmentation.Buffered</code></a> — <span class="docstring-category">Type</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><p>Buffer to store transform results</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/FluxML/DataAugmentation.jl/blob/76b7a8b030dd1d1bc4dc2c1fd28823a5f6ec26aa/src/buffered.jl#L44-L46">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="DataAugmentation.BufferedThreadsafe-buffering" href="#DataAugmentation.BufferedThreadsafe-buffering"><code>DataAugmentation.BufferedThreadsafe</code></a> — <span class="docstring-category">Type</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><p>Buffer to store transform results (threadsafe)</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/FluxML/DataAugmentation.jl/blob/76b7a8b030dd1d1bc4dc2c1fd28823a5f6ec26aa/src/buffered.jl#L79-L81">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../projective/gallery/">« Gallery</a><a class="docs-footer-nextpage" href="../preprocessing/">Preprocessing »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Sunday 20 October 2024 13:13">Sunday 20 October 2024</span>. Using Julia version 1.6.7.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> | ||
buffer = apply(tfm, item) # uses apply! internally</code></pre><p>Since <code>Buffered</code> only stores one buffer, you may run into problems when using it in a multi-threading context where different threads invalidate the buffer before it can be used. In that case, you can use <a href="../ref/#DataAugmentation.BufferedThreadsafe"><code>DataAugmentation.BufferedThreadsafe</code></a>, a version of <code>Buffered</code> that keeps a separate buffer for every thread. </p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="DataAugmentation.Buffered-buffering" href="#DataAugmentation.Buffered-buffering"><code>DataAugmentation.Buffered</code></a> — <span class="docstring-category">Type</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><p>Buffer to store transform results</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/FluxML/DataAugmentation.jl/blob/95d17647212f02028b709b5f730c3024232a324b/src/buffered.jl#L44-L46">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="DataAugmentation.BufferedThreadsafe-buffering" href="#DataAugmentation.BufferedThreadsafe-buffering"><code>DataAugmentation.BufferedThreadsafe</code></a> — <span class="docstring-category">Type</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><p>Buffer to store transform results (threadsafe)</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/FluxML/DataAugmentation.jl/blob/95d17647212f02028b709b5f730c3024232a324b/src/buffered.jl#L79-L81">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../projective/gallery/">« Gallery</a><a class="docs-footer-nextpage" href="../preprocessing/">Preprocessing »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Sunday 20 October 2024 15:27">Sunday 20 October 2024</span>. Using Julia version 1.6.7.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
Oops, something went wrong.