"torchvision/csrc/vscode:/vscode.git/clone" did not exist on "c4c28dff8a68fae20eb7f2a82051ef7a388353bd"
layout.html 4.52 KB
Newer Older
1
2
3
4
{% extends "!layout.html" %}

{% block sidebartitle %}
    <div class="version">
5
      <a href="{{ pathto('../versions.html', 1) }}">{{ version }} &#x25BC</a>
6
7
8
    </div>
    {% include "searchbox.html" %}
{% endblock %}
9
10
11
12
13
14
15
16
17
18

{#
    ################################################################################
    # Adding Colab / notebook header like tutorials repo
    # Based off of
    # https://github.com/pytorch/pytorch_sphinx_theme/blob/fe1f3d5b9233497d81d04f55f5750ccad92500be/pytorch_sphinx_theme/layout.html#L275-L319
    ################################################################################
#}

{%- block content %}
moto's avatar
moto committed
19
    {% if 'tutorial' in pagename %}
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

    <div class="pytorch-call-to-action-links">
      <div id="tutorial-type">{{ pagename }}</div>

      <div id="google-colab-link">
        <img class="call-to-action-img" src="{{ pathto('_static/images/pytorch-colab.svg', 1) }}"/>
        <div class="call-to-action-desktop-view">Run in Google Colab</div>
        <div class="call-to-action-mobile-view">Colab</div>
      </div>
      <div id="download-notebook-link">
        <img class="call-to-action-notebook-img" src="{{ pathto('_static/images/pytorch-download.svg', 1) }}"/>
        <div class="call-to-action-desktop-view">Download Notebook</div>
        <div class="call-to-action-mobile-view">Notebook</div>
      </div>
      <div id="github-view-link">
        <img class="call-to-action-img" src="{{ pathto('_static/images/pytorch-github.svg', 1) }}"/>
        <div class="call-to-action-desktop-view">View on GitHub</div>
        <div class="call-to-action-mobile-view">GitHub</div>
      </div>
    </div>

    {% endif %}
    {{ super() }}

{% endblock %}

{#
    ################################################################################
    # Because the repo URL is hardcoded to pytorch/tutorials,
    # we need to modify the URL to pytorch/audio.
    # We insert the script in footer so that it is executed after the main `theme.js` is loaded
    # Based off of
    # https://github.com/pytorch/pytorch_sphinx_theme/blob/b4d00058a48604d8fb63771b513a50450f0ee188/js/theme.js#L245-L263
    ################################################################################
#}

{%- block footer %}
moto's avatar
moto committed
57
    <script type="text/javascript">
moto's avatar
moto committed
58
    var collapsedSections = ['API Tutorials', 'Pipeline Tutorials']
moto's avatar
moto committed
59
    </script>
60
61
62
63
64
    {{ super() }}
    <script type="text/javascript">
      $(document).ready(function() {
	  var downloadNote = $(".sphx-glr-download-link-note.admonition.note");
	  if (downloadNote.length >= 1) {
moto's avatar
moto committed
65
66
	      var tutorialUrl = $("#tutorial-type").text();
	      var githubLink = "https://github.com/pytorch/audio/blob/main/examples/"  + tutorialUrl + ".py",
67
68
		  notebookLink = $(".reference.download")[1].href,
		  notebookDownloadPath = notebookLink.split('_downloads')[1],
moto's avatar
moto committed
69
		  colabLink = "https://colab.research.google.com/github/pytorch/audio/blob/gh-pages/main/_downloads" + notebookDownloadPath;
70
71
72
73

	      $(".pytorch-call-to-action-links a[data-response='Run in Google Colab']").attr("href", colabLink);
	      $(".pytorch-call-to-action-links a[data-response='View on Github']").attr("href", githubLink);
	  }
74

moto's avatar
moto committed
75
76
77
78
79
80
81
82
83
          var overwrite = function(_) {
              if ($(this).length > 0) {
                  $(this)[0].href = "https://github.com/pytorch/audio"
              }
          }
          // PC
          $(".main-menu a:contains('GitHub')").each(overwrite);
          // Mobile
          $(".main-menu a:contains('Github')").each(overwrite);
84
      });
moto's avatar
moto committed
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

      {% if 'tutorial' in pagename %}
      {#
       # Override the right side menu bar behavior so that subsections
       # are shown by default in tutorial page.
       # Based off of
       # https://github.com/pytorch/pytorch_sphinx_theme/blob/b4d00058a48604d8fb63771b513a50450f0ee188/pytorch_sphinx_theme/static/js/theme.js#L568-L579
       #}
       $(window).ready(function() {
           var original = window.sideMenus.bind;
           var startup = true;
           window.sideMenus.bind = function() {
               original();
               if (startup) {
                   $("#pytorch-right-menu a.reference.internal").each(function(i) {
                       if (this.classList.contains("not-expanded")) {
                           this.nextElementSibling.style.display = "block";
                           this.classList.remove("not-expanded");
                           this.classList.add("expanded");
                       }
                   });
                   startup = false;
               }
           };
       });
moto's avatar
moto committed
110
      {% endif %}
111
    </script>
112
{% endblock %}