Skip to content

Commit ee37770

Browse files
authored
Add Microsoft Learn link to navigation on LTB pages (#1541)
* add microsoft link to nav * Create staging.yml (#50) * fix image for run ms learn * fix format * add image * fix href check * updated "in the cloud" to ms learn * fix default link id * remove staging github action * fix run in ms learn
1 parent aff18d8 commit ee37770

File tree

3 files changed

+120
-1
lines changed

3 files changed

+120
-1
lines changed

_static/images/microsoft-logo.svg

Lines changed: 80 additions & 0 deletions
Loading

_templates/layout.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,43 @@
33
{% block footer %}
44
{{ super() }}
55
<script>
6+
7+
8+
//add microsoft link
9+
10+
if(window.location.href.indexOf("/beginner/basics/")!= -1)
11+
{
12+
var url="https://docs.microsoft.com/learn/paths/pytorch-fundamentals/?wt.mc_id=aiml-7486-cxa";
13+
switch(window.location.pathname.split("/").pop().replace('.html',''))
14+
{
15+
case"quickstart_tutorial":
16+
url="https://docs.microsoft.com/learn/modules/intro-machine-learning-pytorch/9-quickstart?WT.mc_id=aiml-7486-cxa";
17+
break;
18+
case"tensorqs_tutorial":
19+
url="https://docs.microsoft.com/learn/modules/intro-machine-learning-pytorch/2-tensors?WT.mc_id=aiml-7486-cxa";
20+
break;
21+
case"data_tutorial":
22+
url="https://docs.microsoft.com/learn/modules/intro-machine-learning-pytorch/3-data?WT.mc_id=aiml-7486-cxa";
23+
break;
24+
case"transforms_tutorial":
25+
url="https://docs.microsoft.com/learn/modules/intro-machine-learning-pytorch/4-transforms?WT.mc_id=aiml-7486-cxa";
26+
break;
27+
case"buildmodel_tutorial":
28+
url="https://docs.microsoft.com/learn/modules/intro-machine-learning-pytorch/5-model?WT.mc_id=aiml-7486-cxa";
29+
break;
30+
case"autogradqs_tutorial":
31+
url="https://docs.microsoft.com/learn/modules/intro-machine-learning-pytorch/6-autograd?WT.mc_id=aiml-7486-cxa";
32+
break;
33+
case"optimization_tutorial":
34+
url="https://docs.microsoft.com/learn/modules/intro-machine-learning-pytorch/7-optimization?WT.mc_id=aiml-7486-cxa";
35+
break;
36+
case"saveloadrun_tutorial":
37+
url="https://docs.microsoft.com/learn/modules/intro-machine-learning-pytorch/8-inference?WT.mc_id=aiml-7486-cxa";
38+
}
39+
40+
$(".pytorch-call-to-action-links").children().first().before("<a href="+url+' data-behavior="call-to-action-event" data-response="Run in Microsoft Learn" target="_blank"><div id="microsoft-learn-link" style="padding-bottom: 0.625rem;border-bottom: 1px solid #f3f4f7;padding-right: 2.5rem;display: -webkit-box; display: -ms-flexbox; isplay: flex; -webkit-box-align: center;-ms-flex-align: center;align-items: center;"><img class="call-to-action-img" src="../../_static/images/microsoft-logo.svg"/><div class="call-to-action-desktop-view">Run in Microsoft Learn</div><div class="call-to-action-mobile-view">Learn</div></div></a>')
41+
}
42+
643
!function(f,b,e,v,n,t,s)
744
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
845
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
@@ -46,6 +83,8 @@
4683
$(".rating-container").hide();
4784
$(".hr-bottom").hide();
4885
}
86+
87+
4988
</script>
5089

5190
<noscript>

beginner_source/basics/intro.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
------------------
3535
You can run this tutorial in a couple of ways:
3636
37-
- **In the cloud**: This is the easiest way to get started! Each section has a Colab link at the top, which opens a notebook with the code in a fully-hosted environment. Pro tip: Use Colab with a GPU runtime to speed up operations *Runtime > Change runtime type > GPU*
37+
- **In the cloud**: This is the easiest way to get started! Each section has a "Run in Microsoft Learn" link at the top, which opens an integrated notebook in Microsoft Learn with the code in a fully-hosted environment.
3838
- **Locally**: This option requires you to setup PyTorch and TorchVision first on your local machine (`installation instructions <https://pytorch.org/get-started/locally/>`_). Download the notebook or copy the code into your favorite IDE.
3939
4040

0 commit comments

Comments
 (0)