quick-start-module.js assets vs. _include

Created Diff never expires
4 removals
266 lines
3 additions
265 lines
// Keys are Substrings as diplayed by navigator.platform
// Keys are Substrings as diplayed by navigator.platform
var supportedOperatingSystems = new Map([
var supportedOperatingSystems = new Map([
['linux', 'linux'],
['linux', 'linux'],
['mac', 'macos'],
['mac', 'macos'],
['win', 'windows'],
['win', 'windows'],
]);
]);


var archInfoMap = new Map([
var archInfoMap = new Map([
['cuda', {title: "CUDA", platforms: new Set(['linux', 'windows'])}],
['cuda', {title: "CUDA", platforms: new Set(['linux', 'windows'])}],
['rocm', {title: "ROCm", platforms: new Set(['linux'])}],
['rocm', {title: "ROCm", platforms: new Set(['linux'])}],
['accnone', {title: "CPU", platforms: new Set(['linux', 'macos', 'windows'])}]
['accnone', {title: "CPU", platforms: new Set(['linux', 'macos', 'windows'])}]
]);
]);


let version_map={"nightly": {"accnone": ["cpu", ""], "cuda.x": ["cuda", "11.8"], "cuda.y": ["cuda", "12.1"], "rocm5.x": ["rocm", "5.5"]}, "release": {"accnone": ["cpu", ""], "cuda.x": ["cuda", "11.7"], "cuda.y": ["cuda", "11.8"], "rocm5.x": ["rocm", "5.4.2"]}}
let version_map={{ ACC ARCH MAP }}
let stable_version="Stable (2.0.1)";
let stable_version={{ VERSION }};


var default_selected_os = getAnchorSelectedOS() || getDefaultSelectedOS();
var default_selected_os = getAnchorSelectedOS() || getDefaultSelectedOS();
var opts = {
var opts = {
cuda: getPreferredCuda(default_selected_os),
cuda: getPreferredCuda(default_selected_os),
os: default_selected_os,
os: default_selected_os,
pm: 'pip',
pm: 'pip',
language: 'python',
language: 'python',
ptbuild: 'stable',
ptbuild: 'stable',
};
};


var supportedCloudPlatforms = [
var supportedCloudPlatforms = [
'aws',
'aws',
'google-cloud',
'google-cloud',
'microsoft-azure',
'microsoft-azure',
];
];


var os = $(".os > .option");
var os = $(".os > .option");
var package = $(".package > .option");
var package = $(".package > .option");
var language = $(".language > .option");
var language = $(".language > .option");
var cuda = $(".cuda > .option");
var cuda = $(".cuda > .option");
var ptbuild = $(".ptbuild > .option");
var ptbuild = $(".ptbuild > .option");


os.on("click", function() {
os.on("click", function() {
selectedOption(os, this, "os");
selectedOption(os, this, "os");
});
});
package.on("click", function() {
package.on("click", function() {
selectedOption(package, this, "pm");
selectedOption(package, this, "pm");
});
});
language.on("click", function() {
language.on("click", function() {
selectedOption(language, this, "language");
selectedOption(language, this, "language");
});
});
cuda.on("click", function() {
cuda.on("click", function() {
selectedOption(cuda, this, "cuda");
selectedOption(cuda, this, "cuda");
});
});
ptbuild.on("click", function() {
ptbuild.on("click", function() {
selectedOption(ptbuild, this, "ptbuild")
selectedOption(ptbuild, this, "ptbuild")
});
});


// Pre-select user's operating system
// Pre-select user's operating system
$(function() {
$(function() {
var userOsOption = document.getElementById(opts.os);
var userOsOption = document.getElementById(opts.os);
var userCudaOption = document.getElementById(opts.cuda);
var userCudaOption = document.getElementById(opts.cuda);
if (userOsOption) {
if (userOsOption) {
$(userOsOption).trigger("click");
$(userOsOption).trigger("click");
}
}
if (userCudaOption) {
if (userCudaOption) {
$(userCudaOption).trigger("click");
$(userCudaOption).trigger("click");
}
}
});
});




// determine os (mac, linux, windows) based on user's platform
// determine os (mac, linux, windows) based on user's platform
function getDefaultSelectedOS() {
function getDefaultSelectedOS() {
var platform = navigator.platform.toLowerCase();
var platform = navigator.platform.toLowerCase();
for (var [navPlatformSubstring, os] of supportedOperatingSystems.entries()) {
for (var [navPlatformSubstring, os] of supportedOperatingSystems.entries()) {
if (platform.indexOf(navPlatformSubstring) !== -1) {
if (platform.indexOf(navPlatformSubstring) !== -1) {
return os;
return os;
}
}
}
}
// Just return something if user platform is not in our supported map
// Just return something if user platform is not in our supported map
return supportedOperatingSystems.values().next().value;
return supportedOperatingSystems.values().next().value;
}
}


// determine os based on location hash
// determine os based on location hash
function getAnchorSelectedOS() {
function getAnchorSelectedOS() {
var anchor = location.hash;
var anchor = location.hash;
var ANCHOR_REGEX = /^#[^ ]+$/;
var ANCHOR_REGEX = /^#[^ ]+$/;
// Look for anchor in the href
// Look for anchor in the href
if (!ANCHOR_REGEX.test(anchor)) {
if (!ANCHOR_REGEX.test(anchor)) {
return false;
return false;
}
}
// Look for anchor with OS in the first portion
// Look for anchor with OS in the first portion
var testOS = anchor.slice(1).split("-")[0];
var testOS = anchor.slice(1).split("-")[0];
for (var [navPlatformSubstring, os] of supportedOperatingSystems.entries()) {
for (var [navPlatformSubstring, os] of supportedOperatingSystems.entries()) {
if (testOS.indexOf(navPlatformSubstring) !== -1) {
if (testOS.indexOf(navPlatformSubstring) !== -1) {
return os;
return os;
}
}
}
}
return false;
return false;
}
}


// determine CUDA version based on OS
// determine CUDA version based on OS
function getPreferredCuda(os) {
function getPreferredCuda(os) {
// Only CPU builds are currently available for MacOS
// Only CPU builds are currently available for MacOS
if (os == 'macos') {
if (os == 'macos') {
return 'accnone';
return 'accnone';
}
}
return 'cuda.x';
return 'cuda.x';
}
}


// Disable compute platform not supported on OS
// Disable compute platform not supported on OS
function disableUnsupportedPlatforms(os) {
function disableUnsupportedPlatforms(os) {
for (const [arch_key, info] of archInfoMap) {
for (const [arch_key, info] of archInfoMap) {
var elems = document.querySelectorAll('[id^="'+arch_key+'"]');
var elems = document.querySelectorAll('[id^="'+arch_key+'"]');
if (elems == null) {
if (elems == null) {
console.log("Failed to find element for architecture " + arch_key);
console.log("Failed to find element for architecture " + arch_key);
return;
return;
}
}
for (var i=0; i < elems.length;i++) {
for (var i=0; i < elems.length;i++) {
var supported = info.platforms.has(os);
var supported = info.platforms.has(os);
elems[i].style.textDecoration = supported ? "" : "line-through";
elems[i].style.textDecoration = supported ? "" : "line-through";
}
}
}
}
}
}


// Change compute versions depending on build type
// Change compute versions depending on build type
function changeVersion(ptbuild) {
function changeVersion(ptbuild) {


if(ptbuild == "preview")
if(ptbuild == "preview")
archMap = version_map.nightly
archMap = version_map.nightly
else
else
archMap = version_map.release
archMap = version_map.release


for (const [arch_key, info] of archInfoMap) {
for (const [arch_key, info] of archInfoMap) {
var elems = document.querySelectorAll('[id^="'+arch_key+'"]');
var elems = document.querySelectorAll('[id^="'+arch_key+'"]');
for (var i=0; i < elems.length;i++) {
for (var i=0; i < elems.length;i++) {
elems[i].children[0].textContent = info.title + " " + archMap[elems[i].id][1]
elems[i].children[0].textContent = info.title + " " + archMap[elems[i].id][1]
}
}
}
}
var stable_element = document.getElementById("stable");
var stable_element = document.getElementById("stable");
stable_element.children[0].textContent = stable_version;
stable_element.children[0].textContent = stable_version;
}
}






// Change accnone name depending on OS type
// Change accnone name depending on OS type
function changeAccNoneName(osname) {
function changeAccNoneName(osname) {
var accnone_element = document.getElementById("accnone");
var accnone_element = document.getElementById("accnone");
if (accnone_element == null) {
if (accnone_element == null) {
console.log("Failed to find accnone element");
console.log("Failed to find accnone element");
return;
return;
}
}
if (osname == "macos") {
if (osname == "macos") {
accnone_element.children[0].textContent = "Default";
accnone_element.children[0].textContent = "Default";
} else {
} else {
accnone_element.children[0].textContent = "CPU";
accnone_element.children[0].textContent = "CPU";
}
}
}
}


function selectedOption(option, selection, category) {
function selectedOption(option, selection, category) {
$(option).removeClass("selected");
$(option).removeClass("selected");
$(selection).addClass("selected");
$(selection).addClass("selected");
opts[category] = selection.id;
opts[category] = selection.id;
if (category === "pm") {
if (category === "pm") {
var elements = document.getElementsByClassName("language")[0].children;
var elements = document.getElementsByClassName("language")[0].children;
if (selection.id !== "libtorch" && elements["cplusplus"].classList.contains("selected")) {
if (selection.id !== "libtorch" && elements["cplusplus"].classList.contains("selected")) {
$(elements["cplusplus"]).removeClass("selected");
$(elements["cplusplus"]).removeClass("selected");
$(elements["python"]).addClass("selected");
$(elements["python"]).addClass("selected");
opts["language"] = "python";
opts["language"] = "python";
} else if (selection.id == "libtorch") {
} else if (selection.id == "libtorch") {
for (var i = 0; i < elements.length; i++) {
for (var i = 0; i < elements.length; i++) {
if (elements[i].id === "cplusplus") {
if (elements[i].id === "cplusplus") {
$(elements[i]).addClass("selected");
$(elements[i]).addClass("selected");
opts["language"] = "cplusplus";
opts["language"] = "cplusplus";
} else {
} else {
$(elements[i]).removeClass("selected");
$(elements[i]).removeClass("selected");
}
}
}
}
}
}
} else if (category === "language") {
} else if (category === "language") {
var elements = document.getElementsByClassName("package")[0].children;
var elements = document.getElementsByClassName("package")[0].children;
if (selection.id !== "cplusplus" && elements["libtorch"].classList.contains("selected")) {
if (selection.id !== "cplusplus" && elements["libtorch"].classList.contains("selected")) {
$(elements["libtorch"]).removeClass("selected");
$(elements["libtorch"]).removeClass("selected");
$(elements["pip"]).addClass("selected");
$(elements["pip"]).addClass("selected");
opts["pm"] = "pip";
opts["pm"] = "pip";
} else if (selection.id == "cplusplus") {
} else if (selection.id == "cplusplus") {
for (var i = 0; i < elements.length; i++) {
for (var i = 0; i < elements.length; i++) {
if (elements[i].id === "libtorch") {
if (elements[i].id === "libtorch") {
$(elements[i]).addClass("selected");
$(elements[i]).addClass("selected");
opts["pm"] = "libtorch";
opts["pm"] = "libtorch";
} else {
} else {
$(elements[i]).removeClass("selected");
$(elements[i]).removeClass("selected");
}
}
}
}
}
}
} else if (category == "ptbuild") {
} else if (category == "ptbuild") {
changeVersion(opts.ptbuild);
changeVersion(opts.ptbuild);
}
}
commandMessage(buildMatcher());
commandMessage(buildMatcher());
if (category === "os") {
if (category === "os") {
disableUnsupportedPlatforms(opts.os);
disableUnsupportedPlatforms(opts.os);
display(opts.os, 'installation', 'os');
display(opts.os, 'installation', 'os');
}
}
changeAccNoneName(opts.os);
changeAccNoneName(opts.os);
}
}


function display(selection, id, category) {
function display(selection, id, category) {
var container = document.getElementById(id);
var container = document.getElementById(id);
// Check if there's a container to display the selection
// Check if there's a container to display the selection
if (container === null) {
if (container === null) {
return;
return;
}
}
var elements = container.getElementsByClassName(category);
var elements = container.getElementsByClassName(category);
for (var i = 0; i < elements.length; i++) {
for (var i = 0; i < elements.length; i++) {
if (elements[i].classList.contains(selection)) {
if (elements[i].classList.contains(selection)) {
$(elements[i]).addClass("selected");
$(elements[i]).addClass("selected");
} else {
} else {
$(elements[i]).removeClass("selected");
$(elements[i]).removeClass("selected");
}
}
}
}
}
}


function buildMatcher() {
function buildMatcher() {
return (
return (
opts.ptbuild.toLowerCase() +
opts.ptbuild.toLowerCase() +
"," +
"," +
opts.pm.toLowerCase() +
opts.pm.toLowerCase() +
"," +
"," +
opts.os.toLowerCase() +
opts.os.toLowerCase() +
"," +
"," +
opts.cuda.toLowerCase() +
opts.cuda.toLowerCase() +
"," +
"," +
opts.language.toLowerCase()
opts.language.toLowerCase()
);
);
}
}


// Cloud Partners sub-menu toggle listeners
// Cloud Partners sub-menu toggle listeners
$("[data-toggle='cloud-dropdown']").on("click", function(e) {
$("[data-toggle='cloud-dropdown']").on("click", function(e) {
if ($(this).hasClass("open")) {
if ($(this).hasClass("open")) {
$(this).removeClass("open");
$(this).removeClass("open");
// If you deselect a current drop-down item, don't display it's info any longer
// If you deselect a current drop-down item, don't display it's info any longer
display(null, 'cloud', 'platform');
display(null, 'cloud', 'platform');
} else {
} else {
$("[data-toggle='cloud-dropdown'].open").removeClass("open");
$("[data-toggle='cloud-dropdown'].open").removeClass("open");
$(this).addClass("open");
$(this).addClass("open");
var cls = $(this).find(".cloud-option-body")[0].className;
var cls = $(this).find(".cloud-option-body")[0].className;
for (var i = 0; i < supportedCloudPlatforms.length; i++) {
for (var i = 0; i < supportedCloudPlatforms.length; i++) {
if (cls.includes(supportedCloudPlatforms[i])) {
if (cls.includes(supportedCloudPlatforms[i])) {
display(supportedCloudPlatforms[i], 'cloud', 'platform');
display(supportedCloudPlatforms[i], 'cloud', 'platform');
}
}
}
}
}
}
});
});


function commandMessage(key) {
function commandMessage(key) {
var object = {"preview,pip,linux,accnone,python": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,linux,cuda.x,python": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118", "preview,pip,linux,cuda.y,python": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121", "preview,pip,linux,rocm5.x,python": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm5.5", "preview,conda,linux,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch-nightly -c nvidia", "preview,conda,linux,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia", "preview,conda,linux,rocm5.x,python": "<b>NOTE:</b> Conda packages are not currently available for ROCm, please use pip instead<br />", "preview,conda,linux,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly", "preview,libtorch,linux,accnone,cplusplus": "Download here (Pre-cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/nightly/cpu/libtorch-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/cpu/libtorch-shared-with-deps-latest.zip</a><br />Download here (cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/nightly/cpu/libtorch-cxx11-abi-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/cpu/libtorch-cxx11-abi-shared-with-deps-latest.zip</a>", "preview,libtorch,linux,cuda.x,cplusplus": "Download here (Pre-cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-latest.zip</a><br />Download here (cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-latest.zip</a>", "preview,libtorch,linux,cuda.y,cplusplus": "Download here (Pre-cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/nightly/cu121/libtorch-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/cu121/libtorch-shared-with-deps-latest.zip</a><br />Download here (cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/nightly/cu121/libtorch-cxx11-abi-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/cu121/libtorch-cxx11-abi-shared-with-deps-latest.zip</a>", "preview,libtorch,linux,rocm5.x,cplusplus": "Download here (Pre-cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/nightly/rocm5.5/libtorch-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/rocm5.5/libtorch-shared-with-deps-latest.zip</a><br />Download here (cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/nightly/rocm5.5/libtorch-cxx11-abi-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/rocm5.5/libtorch-cxx11-abi-shared-with-deps-latest.zip</a>", "preview,pip,macos,cuda.x,python": "# CUDA is not available on MacOS, please use default package<br />pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,macos,cuda.y,python": "# CUDA is not available on MacOS, please use default package<br />pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,macos,rocm5.x,python": "# ROCm is not available on MacOS, please use default package<br />pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,macos,accnone,python": "# MPS acceleration is available on MacOS 12.3+<br />pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu", "preview,conda,macos,cuda.x,python": "# CUDA is not available on MacOS, please use default package<br />conda install pytorch-nightly::pytorch torchvision torchaudio -c pytorch-nightly", "preview,conda,macos,cuda.y,python": "# CUDA is not available on MacOS, please use default package<br />conda install pytorch-nightly::pytorch torchvision torchaudio -c pytorch-nightly", "preview,conda,macos,rocm5.x,python": "# ROCm is not available on MacOS, please use default package<br />conda install pytorch-nightly::pytorch torchvision torchaudio -c pytorch-nightly", "preview,conda,macos,accnone,python": "# MPS acceleration is available on MacOS 12.3+<br />conda install pytorch-nightly::pytorch torchvision torchaudio -c pytorch-nightly", "preview,libtorch,macos,accnone,cplusplus": "Download default libtorch here (ROCm and CUDA are not supported):<br /><a href='https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip'>https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip</a>", "preview,libtorch,macos,cuda.x,cplusplus": "Download default libtorch here (ROCm and CUDA are not supported):<br /><a href='https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip'>https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip</a>", "preview,libtorch,macos,cuda.y,cplusplus": "Download default libtorch here (ROCm and CUDA are not supported):<br /><a href='https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip'>https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip</a>", "preview,libtorch,macos,rocm5.x,cplusplus": "Download default libtorch here (ROCm and CUDA are not supported):<br /><a href='https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip'>https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip</a>", "preview,pip,windows,accnone,python": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,windows,cuda.x,python": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118", "preview,pip,windows,cuda.y,python": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121", "preview,pip,windows,rocm5.x,python": "<b>NOTE:</b> ROCm is not available on Windows", "preview,conda,windows,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch-nightly -c nvidia", "preview,conda,windows,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia", "preview,conda,windows,rocm5.x,python": "<b>NOTE:</b> ROCm is not available on Windows", "preview,conda,windows,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly", "preview,libtorch,windows,accnone,cplusplus": "Download here (Release version):<br /><a href='https://download.pytorch.org/libtorch/nightly/cpu/libtorch-win-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/cpu/libtorch-win-shared-with-deps-latest.zip</a><br />Download here (Debug version):<br /><a href='https://download.pytorch.org/libtorch/nightly/cpu/libtorch-win-shared-with-deps-debug-latest.zip'>https://download.pytorch.org/libtorch/nightly/cpu/libtorch-win-shared-with-deps-debug-latest.zip</a>", "preview,libtorch,windows,cuda.x,cplusplus": "Download here (Release version):<br /><a href='https://download.pytorch.org/libtorch/nightly/cu118/libtorch-win-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/cu118/libtorch-win-shared-with-deps-latest.zip</a><br />Download here (Debug version):<br /><a href='https://download.pytorch.org/libtorch/nightly/cu118/libtorch-win-shared-with-deps-debug-latest.zip'>https://download.pytorch.org/libtorch/nightly/cu118/libtorch-win-shared-with-deps-debug-latest.zip</a>", "preview,libtorch,windows,cuda.y,cplusplus": "Download here (Release version):<br /><a href='https://download.pytorch.org/libtorch/nightly/cu121/libtorch-win-shared-with-deps-latest.zip'>https://download.pytorch.org/libtorch/nightly/cu121/libtorch-win-shared-with-deps-latest.zip</a><br />Download here (Debug version):<br /><a href='https://download.pytorch.org/libtorch/nightly/cu121/libtorch-win-shared-with-deps-debug-latest.zip'>https://download.pytorch.org/libtorch/nightly/cu121/libtorch-win-shared-with-deps-debug-latest.zip</a>", "preview,libtorch,windows,rocm5.x,cplusplus": "<b>NOTE:</b> ROCm is not available on Windows", "stable,pip,linux,accnone,python": "pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu", "stable,pip,linux,cuda.x,python": "pip3 install torch torchvision torchaudio", "stable,pip,linux,cuda.y,python": "pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118", "stable,pip,linux,rocm5.x,python": "pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2", "stable,conda,linux,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia", "stable,conda,linux,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia", "stable,conda,linux,rocm5.x,python": "<b>NOTE:</b> Conda packages are not currently available for ROCm, please use pip instead<br />", "stable,conda,linux,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch", "stable,libtorch,linux,accnone,cplusplus": "Download here (Pre-cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.0.1%2Bcpu.zip'>https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.0.1%2Bcpu.zip</a><br />Download here (cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcpu.zip'>https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcpu.zip</a>", "stable,libtorch,linux,cuda.x,cplusplus": "Download here (Pre-cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/cu117/libtorch-shared-with-deps-2.0.1%2Bcu117.zip'>https://download.pytorch.org/libtorch/cu117/libtorch-shared-with-deps-2.0.1%2Bcu117.zip</a><br />Download here (cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/cu117/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcu117.zip'>https://download.pytorch.org/libtorch/cu117/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcu117.zip</a>", "stable,libtorch,linux,cuda.y,cplusplus": "Download here (Pre-cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/cu118/libtorch-shared-with-deps-2.0.1%2Bcu118.zip'>https://download.pytorch.org/libtorch/cu118/libtorch-shared-with-deps-2.0.1%2Bcu118.zip</a><br />Download here (cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcu118.zip'>https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcu118.zip</a>", "stable,libtorch,linux,rocm5.x,cplusplus": "Download here (Pre-cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/rocm5.4.2/libtorch-shared-with-deps-2.0.1%2Brocm5.4.2.zip'>https://download.pytorch.org/libtorch/rocm5.4.2/libtorch-shared-with-deps-2.0.1%2Brocm5.4.2.zip</a><br />Download here (cxx11 ABI):<br /><a href='https://download.pytorch.org/libtorch/rocm5.4.2/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Brocm5.4.2.zip'>https://download.pytorch.org/libtorch/rocm5.4.2/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Brocm5.4.2.zip</a>", "stable,pip,macos,cuda.x,python": "# CUDA is not available on MacOS, please use default package<br />pip3 install torch torchvision torchaudio", "stable,pip,macos,cuda.y,python": "# CUDA is not available on MacOS, please use default package<br />pip3 install torch torchvision torchaudio", "stable,pip,macos,rocm5.x,python": "# ROCm is not available on MacOS, please use default package<br />pip3 install torch torchvision torchaudio", "stable,pip,macos,accnone,python": "# MPS acceleration is available on MacOS 12.3+<br />pip3 install torch torchvision torchaudio", "stable,conda,macos,cuda.x,python": "# CUDA is not available on MacOS, please use default package<br />conda install pytorch::pytorch torchvision torchaudio -c pytorch", "stable,conda,macos,cuda.y,python": "# CUDA is not available on MacOS, please use default package<br />conda install pytorch::pytorch torchvision torchaudio -c pytorch", "stable,conda,macos,rocm5.x,python": "# ROCm is not available on MacOS, please use default package<br />conda install pytorch::pytorch torchvision torchaudio -c pytorch", "stable,conda,macos,accnone,python": "# MPS acceleration is available on MacOS 12.3+<br />conda install pytorch::pytorch torchvision torchaudio -c pytorch", "stable,libtorch,macos,accnone,cplusplus": "Download default libtorch here (ROCm and CUDA are not supported):<br /><a href='https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.0.1.zip'>https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.0.1.zip</a>", "stable,libtorch,macos,cuda.x,cplusplus": "Download default libtorch here (ROCm and CUDA are not supported):<br /><a href='https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.0.1.zip'>https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.0.1.zip</a>", "stable,libtorch,macos,cuda.y,cplusplus": "Download default libtorch here (ROCm and CUDA are not supported):<br /><a href='https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.0.1.zip'>https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.0.1.zip</a>", "stable,libtorch,macos,rocm5.x,cplusplus": "Download default libtorch here (ROCm and CUDA are not supported):<br /><a href='https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.0.1.zip'>https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.0.1.zip</a>", "stable,pip,windows,accnone,python": "pip3 install torch torchvision torchaudio", "stable,pip,windows,cuda.x,python": "pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117", "stable,pip,windows,cuda.y,python": "pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118", "stable,pip,windows,rocm5.x,python": "<b>NOTE:</b> ROCm is not available on Windows", "stable,conda,windows,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia", "stable,conda,windows,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia", "stable,conda,windows,rocm5.x,python": "<b>NOTE:</b> ROCm is not available on Windows", "stable,conda,windows,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch", "stable,libtorch,windows,accnone,cplusplus": "Download here (Release version):<br /><a href='https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-2.0.1%2Bcpu.zip'>https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-2.0.1%2Bcpu.zip</a><br />Download here (Debug version):<br /><a href='https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-2.0.1%2Bcpu.zip'>https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-2.0.1%2Bcpu.zip</a>", "stable,libtorch,windows,cuda.x,cplusplus": "Download here (Release version):<br /><a href='https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-2.0.1%2Bcu117.zip'>https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-2.0.1%2Bcu117.zip</a><br />Download here (Debug version):<br /><a href='https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-debug-2.0.1%2Bcu117.zip'>https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-debug-2.0.1%2Bcu117.zip</a>", "stable,libtorch,windows,cuda.y,cplusplus": "Download here (Release version):<br /><a href='https://download.pytorch.org/libtorch/cu118/libtorch-win-shared-with-deps-2.0.1%2Bcu118.zip'>https://download.pytorch.org/libtorch/cu118/libtorch-win-shared-with-deps-2.0.1%2Bcu118.zip</a><br />Download here (Debug version):<br /><a href='https://download.pytorch.org/libtorch/cu118/libtorch-win-shared-with-deps-debug-2.0.1%2Bcu118.zip'>https://download.pytorch.org/libtorch/cu118/libtorch-win-shared-with-deps-debug-2.0.1%2Bcu118.zip</a>", "stable,libtorch,windows,rocm5.x,cplusplus": "<b>NOTE:</b> ROCm is not available on Windows"};
var object = {{ installMatrix }};


if (!object.hasOwnProperty(key)) {
if (!object.hasOwnProperty(key)) {
$("#command").html(
$("#command").html(
"<pre> # Follow instructions at this URL: https://github.com/pytorch/pytorch#from-source </pre>"
"<pre> # Follow instructions at this URL: https://github.com/pytorch/pytorch#from-source </pre>"
);
);
} else if (key.indexOf("lts") == 0 && key.indexOf('rocm') < 0) {
} else if (key.indexOf("lts") == 0 && key.indexOf('rocm') < 0) {
$("#command").html("<pre>" + object[key] + "</pre>");
$("#command").html("<pre>" + object[key] + "</pre>");
} else {
} else {
$("#command").html("<pre>" + object[key] + "</pre>");
$("#command").html("<pre>" + object[key] + "</pre>");
}
}
}
}


// Set cuda version right away
// Set cuda version right away
changeVersion("stable")
changeVersion("stable")