2024-10-15 23:12:17 +08:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "en-US" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=11" / >
2025-02-07 04:16:29 +08:00
< meta name = "generator" content = "Doxygen 1.13.2" / >
2024-10-15 23:12:17 +08:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > MLX: mlx/backend/common/utils.h File Reference< / title >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "jquery.js" > < / script >
< script type = "text/javascript" src = "dynsections.js" > < / script >
< script type = "text/javascript" src = "clipboard.js" > < / script >
< link href = "navtree.css" rel = "stylesheet" type = "text/css" / >
2025-01-10 05:56:20 +08:00
< script type = "text/javascript" src = "navtreedata.js" > < / script >
< script type = "text/javascript" src = "navtree.js" > < / script >
2024-10-15 23:12:17 +08:00
< script type = "text/javascript" src = "resize.js" > < / script >
< script type = "text/javascript" src = "cookie.js" > < / script >
< link href = "search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "search/searchdata.js" > < / script >
< script type = "text/javascript" src = "search/search.js" > < / script >
2025-01-10 05:56:20 +08:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(function() { init_search(); });
/* @license-end */
< / script >
2024-10-15 23:12:17 +08:00
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr id = "projectrow" >
< td id = "projectalign" >
< div id = "projectname" > MLX
< / div >
< / td >
2025-01-10 05:56:20 +08:00
< td > < div id = "MSearchBox" class = "MSearchBoxInactive" >
< span class = "left" >
< span id = "MSearchSelect" onmouseover = "return searchBox.OnSearchSelectShow()" onmouseout = "return searchBox.OnSearchSelectHide()" >   < / span >
< input type = "text" id = "MSearchField" value = "" placeholder = "Search" accesskey = "S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
< / span > < span class = "right" >
< a id = "MSearchClose" href = "javascript:searchBox.CloseResultsWindow()" > < img id = "MSearchCloseImg" border = "0" src = "search/close.svg" alt = "" / > < / a >
< / span >
< / div >
< / td >
2024-10-15 23:12:17 +08:00
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2025-02-07 04:16:29 +08:00
<!-- Generated by Doxygen 1.13.2 -->
2024-10-15 23:12:17 +08:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
< / script >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
< / script >
2025-01-10 05:56:20 +08:00
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
< div id = "splitbar" style = "-moz-user-select:none;"
class="ui-resizable-handle">
< / div >
< / div >
2024-10-15 23:12:17 +08:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2025-01-10 05:56:20 +08:00
$(function(){initNavTree('backend_2common_2utils_8h.html',''); initResizable(true); });
2024-10-15 23:12:17 +08:00
/* @license-end */
< / script >
2025-01-10 05:56:20 +08:00
< div id = "doc-content" >
2024-10-15 23:12:17 +08:00
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
< div id = "MSearchResults" >
< div class = "SRPage" >
< div id = "SRIndex" >
< div id = "SRResults" > < / div >
< div class = "SRStatus" id = "Loading" > Loading...< / div >
< div class = "SRStatus" id = "Searching" > Searching...< / div >
< div class = "SRStatus" id = "NoMatches" > No Matches< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "header" >
< div class = "summary" >
< a href = "#nested-classes" > Classes< / a > |
< a href = "#namespaces" > Namespaces< / a > |
< a href = "#func-members" > Functions< / a > < / div >
< div class = "headertitle" > < div class = "title" > utils.h File Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< div class = "textblock" > < code > #include < vector> < / code > < br / >
< code > #include " < a class = "el" href = "array_8h_source.html" > mlx/array.h< / a > " < / code > < br / >
< / div >
< p > < a href = "backend_2common_2utils_8h_source.html" > Go to the source code of this file.< / a > < / p >
< table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "nested-classes" name = "nested-classes" > < / a >
Classes< / h2 > < / td > < / tr >
2025-01-10 05:56:20 +08:00
< tr class = "memitem:" > < td class = "memItemLeft" align = "right" valign = "top" > struct   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "structmlx_1_1core_1_1_contiguous_iterator.html" > mlx::core::ContiguousIterator< / a > < / td > < / tr >
2024-10-15 23:12:17 +08:00
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "namespaces" name = "namespaces" > < / a >
Namespaces< / h2 > < / td > < / tr >
< tr class = "memitem:" > < td class = "memItemLeft" align = "right" valign = "top" > namespace   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx.html" > mlx< / a > < / td > < / tr >
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:" > < td class = "memItemLeft" align = "right" valign = "top" > namespace   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html" > mlx::core< / a > < / td > < / tr >
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "func-members" name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
2025-01-10 05:56:20 +08:00
< tr class = "memitem:a59c0af06c5325c04ad8d69563c1c6b0a" id = "r_a59c0af06c5325c04ad8d69563c1c6b0a" > < td class = "memItemLeft" align = "right" valign = "top" > int64_t  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#a59c0af06c5325c04ad8d69563c1c6b0a" > mlx::core::elem_to_loc< / a > (int elem, const < a class = "el" href = "namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416" > Shape< / a > & shape, const < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > & strides)< / td > < / tr >
< tr class = "separator:a59c0af06c5325c04ad8d69563c1c6b0a" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ac9c19514210333346f02a4520641847f" id = "r_ac9c19514210333346f02a4520641847f" > < td class = "memItemLeft" align = "right" valign = "top" > int64_t  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#ac9c19514210333346f02a4520641847f" > mlx::core::elem_to_loc< / a > (int elem, const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & a)< / td > < / tr >
< tr class = "separator:ac9c19514210333346f02a4520641847f" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a449ef1148816a37bbc7ffd43d3c586a0" id = "r_a449ef1148816a37bbc7ffd43d3c586a0" > < td class = "memItemLeft" align = "right" valign = "top" > < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#a449ef1148816a37bbc7ffd43d3c586a0" > mlx::core::make_contiguous_strides< / a > (const < a class = "el" href = "namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416" > Shape< / a > & shape)< / td > < / tr >
< tr class = "separator:a449ef1148816a37bbc7ffd43d3c586a0" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a4d594bb84abeff4619d1abb77b20123e" id = "r_a4d594bb84abeff4619d1abb77b20123e" > < td class = "memItemLeft" align = "right" valign = "top" > std::tuple< < a class = "el" href = "namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416" > Shape< / a > , std::vector< < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > > >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#a4d594bb84abeff4619d1abb77b20123e" > mlx::core::collapse_contiguous_dims< / a > (const < a class = "el" href = "namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416" > Shape< / a > & shape, const std::vector< < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > > & strides, int64_t size_cap=std::numeric_limits< int32_t > < a class = "el" href = "group__ops.html#ga7fed87d96cc7741d8267f4eac83f5fe7" > ::max< / a > ())< / td > < / tr >
< tr class = "separator:a4d594bb84abeff4619d1abb77b20123e" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a977c7c84de79ad67055ae2a89b7f6869" id = "r_a977c7c84de79ad67055ae2a89b7f6869" > < td class = "memItemLeft" align = "right" valign = "top" > std::tuple< < a class = "el" href = "namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416" > Shape< / a > , std::vector< < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > > >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#a977c7c84de79ad67055ae2a89b7f6869" > mlx::core::collapse_contiguous_dims< / a > (const std::vector< < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > > & xs, size_t size_cap=std::numeric_limits< int32_t > < a class = "el" href = "group__ops.html#ga7fed87d96cc7741d8267f4eac83f5fe7" > ::max< / a > ())< / td > < / tr >
< tr class = "separator:a977c7c84de79ad67055ae2a89b7f6869" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ac813412cce77fc1340dcfefc6e099276" id = "r_ac813412cce77fc1340dcfefc6e099276" > < td class = "memTemplParams" colspan = "2" > template< typename... Arrays, typename = enable_for_arrays_t< Arrays...> > < / td > < / tr >
2024-10-15 23:12:17 +08:00
< tr class = "memitem:ac813412cce77fc1340dcfefc6e099276" > < td class = "memTemplItemLeft" align = "right" valign = "top" > auto  < / td > < td class = "memTemplItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#ac813412cce77fc1340dcfefc6e099276" > mlx::core::collapse_contiguous_dims< / a > (Arrays & & ... xs)< / td > < / tr >
< tr class = "separator:ac813412cce77fc1340dcfefc6e099276" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2025-01-10 05:56:20 +08:00
< tr class = "memitem:a79acfa8bc30c1f213bf893b5983eb666" id = "r_a79acfa8bc30c1f213bf893b5983eb666" > < td class = "memItemLeft" align = "right" valign = "top" > std::pair< < a class = "el" href = "namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416" > Shape< / a > , < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#a79acfa8bc30c1f213bf893b5983eb666" > mlx::core::collapse_contiguous_dims< / a > (const < a class = "el" href = "namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416" > Shape< / a > & shape, const < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > & strides, int64_t size_cap=std::numeric_limits< int32_t > < a class = "el" href = "group__ops.html#ga7fed87d96cc7741d8267f4eac83f5fe7" > ::max< / a > ())< / td > < / tr >
< tr class = "separator:a79acfa8bc30c1f213bf893b5983eb666" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ab607cd6974ca6606826e785807156d6a" id = "r_ab607cd6974ca6606826e785807156d6a" > < td class = "memItemLeft" align = "right" valign = "top" > std::pair< < a class = "el" href = "namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416" > Shape< / a > , < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#ab607cd6974ca6606826e785807156d6a" > mlx::core::collapse_contiguous_dims< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & a, int64_t size_cap=std::numeric_limits< int32_t > < a class = "el" href = "group__ops.html#ga7fed87d96cc7741d8267f4eac83f5fe7" > ::max< / a > ())< / td > < / tr >
< tr class = "separator:ab607cd6974ca6606826e785807156d6a" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ab2b50a44a9d3a06282be4611f5fc7447" id = "r_ab2b50a44a9d3a06282be4611f5fc7447" > < td class = "memItemLeft" align = "right" valign = "top" > auto  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#ab2b50a44a9d3a06282be4611f5fc7447" > mlx::core::check_contiguity< / a > (const < a class = "el" href = "namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416" > Shape< / a > & shape, const < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > & strides)< / td > < / tr >
< tr class = "separator:ab2b50a44a9d3a06282be4611f5fc7447" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2024-10-15 23:12:17 +08:00
< tr class = "memitem:af650e831ce21759da1ac103037d08d84" id = "r_af650e831ce21759da1ac103037d08d84" > < td class = "memItemLeft" align = "right" valign = "top" > bool  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#af650e831ce21759da1ac103037d08d84" > mlx::core::is_donatable< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & in, const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & out)< / td > < / tr >
< tr class = "separator:af650e831ce21759da1ac103037d08d84" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2024-11-23 04:24:16 +08:00
< tr class = "memitem:a830a47d8a317dffb0c88e5a7afe6aee2" id = "r_a830a47d8a317dffb0c88e5a7afe6aee2" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#a830a47d8a317dffb0c88e5a7afe6aee2" > mlx::core::move_or_copy< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & in, < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & out)< / td > < / tr >
< tr class = "separator:a830a47d8a317dffb0c88e5a7afe6aee2" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2025-01-10 05:56:20 +08:00
< tr class = "memitem:a9fcb3711b150cb65c7778a35c51284b2" id = "r_a9fcb3711b150cb65c7778a35c51284b2" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#a9fcb3711b150cb65c7778a35c51284b2" > mlx::core::move_or_copy< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & in, < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & out, const < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > & strides, < a class = "el" href = "structmlx_1_1core_1_1array_1_1_flags.html" > array::Flags< / a > flags, size_t data_size, size_t offset=0)< / td > < / tr >
< tr class = "separator:a9fcb3711b150cb65c7778a35c51284b2" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a6783cfc7dbe1a116ba84a3904a37145f" id = "r_a6783cfc7dbe1a116ba84a3904a37145f" > < td class = "memItemLeft" align = "right" valign = "top" > std::pair< bool, < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#a6783cfc7dbe1a116ba84a3904a37145f" > mlx::core::prepare_reshape< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & in, const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & out)< / td > < / tr >
< tr class = "separator:a6783cfc7dbe1a116ba84a3904a37145f" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a88d88987bd8bf3ca46bf3b5e8aacce9d" id = "r_a88d88987bd8bf3ca46bf3b5e8aacce9d" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html#a88d88987bd8bf3ca46bf3b5e8aacce9d" > mlx::core::shared_buffer_reshape< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & in, const < a class = "el" href = "namespacemlx_1_1core.html#a79939016d0972ded7db37130da2a8b5c" > Strides< / a > & out_strides, < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & out)< / td > < / tr >
< tr class = "separator:a88d88987bd8bf3ca46bf3b5e8aacce9d" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2024-10-15 23:12:17 +08:00
< / table >
< / div > <!-- contents -->
< / div > <!-- doc - content -->
2025-01-10 05:56:20 +08:00
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
< li class = "navelem" > < a class = "el" href = "dir_938ab0ecf10b8b860ff766c820f665fd.html" > mlx< / a > < / li > < li class = "navelem" > < a class = "el" href = "dir_1d446c9bd3c99228254c9484e0bc5c06.html" > backend< / a > < / li > < li class = "navelem" > < a class = "el" href = "dir_f149b24a1b5be11cd70151abe517e3f8.html" > common< / a > < / li > < li class = "navelem" > < a class = "el" href = "backend_2common_2utils_8h.html" > utils.h< / a > < / li >
2025-02-07 04:16:29 +08:00
< li class = "footer" > Generated by < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.13.2 < / li >
2025-01-10 05:56:20 +08:00
< / ul >
< / div >
2024-10-15 23:12:17 +08:00
< / body >
< / html >