Skip to content

Commit fbc96dd

Browse files
Merge branch 'NVIDIA:master' into correct_doc
2 parents 5b4bd38 + 499535b commit fbc96dd

File tree

103 files changed

+10347
-968
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+10347
-968
lines changed

.github/workflows/blossom-ci.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Copyright (c) 2022, NVIDIA CORPORATION.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# A workflow to trigger ci on hybrid infra (github + self hosted runner)
16+
name: Blossom-CI
17+
on:
18+
issue_comment:
19+
types: [created]
20+
workflow_dispatch:
21+
inputs:
22+
platform:
23+
description: 'runs-on argument'
24+
required: false
25+
args:
26+
description: 'argument'
27+
required: false
28+
jobs:
29+
Get-Authorization:
30+
runs-on: blossom
31+
outputs:
32+
AUTHORIZED: ${{ steps.check-authorization.outputs.defined }}
33+
steps:
34+
- id: check-authorization
35+
env:
36+
AUTHORIZED_USERS: ${{ secrets.AUTHORIZED_USERS }}
37+
if: |
38+
contains( ${{ env.AUTHORIZED_USERS }}, format('{0},', github.actor)) &&
39+
github.event.comment.body == '/nvidia-ci'
40+
run: echo "::set-output name=defined::true"
41+
42+
Authorization:
43+
needs: [Get-Authorization]
44+
name: Authorization
45+
runs-on: blossom
46+
env:
47+
AUTHORIZED_USERS: ${{ secrets.AUTHORIZED_USERS }}
48+
outputs:
49+
args: ${{ env.args }}
50+
51+
# This job only runs for pull request comments
52+
if: needs.Get-Authorization.outputs.check-authorization == 'true'
53+
steps:
54+
- name: Check if comment is issued by authorized person
55+
run: blossom-ci
56+
env:
57+
OPERATION: 'AUTH'
58+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
REPO_KEY_DATA: ${{ secrets.BLOSSOM_KEY }}
60+
61+
Vulnerability-scan:
62+
name: Vulnerability scan
63+
needs: [Authorization]
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Checkout code
67+
uses: actions/checkout@v2
68+
with:
69+
repository: ${{ fromJson(needs.Authorization.outputs.args).repo }}
70+
ref: ${{ fromJson(needs.Authorization.outputs.args).ref }}
71+
lfs: 'true'
72+
73+
- name: Run blossom action
74+
uses: NVIDIA/blossom-action@main
75+
env:
76+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
REPO_KEY_DATA: ${{ secrets.BLOSSOM_KEY }}
78+
with:
79+
args1: ${{ fromJson(needs.Authorization.outputs.args).args1 }}
80+
args2: ${{ fromJson(needs.Authorization.outputs.args).args2 }}
81+
args3: ${{ fromJson(needs.Authorization.outputs.args).args3 }}
82+
83+
Job-trigger:
84+
name: Start ci job
85+
needs: [Vulnerability-scan]
86+
runs-on: blossom
87+
steps:
88+
- name: Start ci job
89+
run: blossom-ci
90+
env:
91+
OPERATION: 'START-CI-JOB'
92+
CI_SERVER: ${{ secrets.CI_SERVER }}
93+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
95+
Upload-Log:
96+
name: Upload log
97+
runs-on: blossom
98+
if : github.event_name == 'workflow_dispatch'
99+
steps:
100+
- name: Jenkins log for pull request ${{ fromJson(github.event.inputs.args).pr }} (click here)
101+
run: blossom-ci
102+
env:
103+
OPERATION: 'POST-PROCESSING'
104+
CI_SERVER: ${{ secrets.CI_SERVER }}
105+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

core/conversion/converters/impl/select.cpp

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,32 @@ namespace converters {
1515
namespace impl {
1616
namespace {
1717

18-
bool add_split(ConversionCtx* ctx, const torch::jit::Node* n, args& args, bool split_list) {
18+
bool add_split(ConversionCtx* ctx, const torch::jit::Node* n, args& args, bool split_list, bool unbind) {
1919
auto in = args[0].ITensor();
20-
auto axis = args[2].unwrapToInt();
21-
auto inDimSize = in->getDimensions().d[axis];
22-
auto numOutputs = 1, numRemainder = 0;
20+
auto numOutputs = 1, numRemainder = 0, axis = 0;
2321
std::vector<int64_t> sizes;
2422

25-
if (split_list) {
26-
sizes = args[1].unwrapToIntList().vec();
27-
numOutputs = sizes.size();
23+
if (unbind) {
24+
axis = args[1].unwrapToInt();
25+
numOutputs = in->getDimensions().d[axis];
26+
sizes.insert(sizes.end(), numOutputs, 1);
2827
} else {
29-
auto split_size = args[1].unwrapToInt();
30-
numOutputs = inDimSize / split_size;
31-
numRemainder = inDimSize % split_size;
32-
for (int64_t i = 0; i < numOutputs; i++) {
33-
sizes.push_back(split_size);
34-
}
35-
if (numRemainder) {
36-
numOutputs += 1;
37-
sizes.push_back(numRemainder);
28+
axis = args[2].unwrapToInt();
29+
auto inDimSize = in->getDimensions().d[axis];
30+
if (split_list) {
31+
sizes = args[1].unwrapToIntList().vec();
32+
numOutputs = sizes.size();
33+
} else {
34+
auto split_size = args[1].unwrapToInt();
35+
numOutputs = inDimSize / split_size;
36+
numRemainder = inDimSize % split_size;
37+
for (int64_t i = 0; i < numOutputs; i++) {
38+
sizes.push_back(split_size);
39+
}
40+
if (numRemainder) {
41+
numOutputs += 1;
42+
sizes.push_back(numRemainder);
43+
}
3844
}
3945
}
4046

@@ -340,19 +346,25 @@ auto select_registrations TORCHTRT_UNUSED =
340346
}})
341347
.pattern({"aten::split(Tensor self, int[] split_sizes, int dim=0) -> (Tensor[])",
342348
[](ConversionCtx* ctx, const torch::jit::Node* n, args& args) -> bool {
343-
add_split(ctx, n, args, true);
349+
add_split(ctx, n, args, true, false);
344350
LOG_DEBUG("Converted split op into a list of IValues");
345351
return true;
346352
}})
347353
.pattern({"aten::split.Tensor(Tensor(a) self, int split_size, int dim=0) -> (Tensor[])",
348354
[](ConversionCtx* ctx, const torch::jit::Node* n, args& args) -> bool {
349-
add_split(ctx, n, args, false);
355+
add_split(ctx, n, args, false, false);
350356
LOG_DEBUG("Converted split op into a list of IValues");
351357
return true;
352358
}})
353359
.pattern({"aten::split_with_sizes(Tensor(a) self, int[] split_sizes, int dim=0) -> (Tensor[])",
354360
[](ConversionCtx* ctx, const torch::jit::Node* n, args& args) -> bool {
355-
add_split(ctx, n, args, true);
361+
add_split(ctx, n, args, true, false);
362+
LOG_DEBUG("Converted split op into a list of IValues");
363+
return true;
364+
}})
365+
.pattern({"aten::unbind.int(Tensor(a -> *) self, int dim=0) -> (Tensor[])",
366+
[](ConversionCtx* ctx, const torch::jit::Node* n, args& args) -> bool {
367+
add_split(ctx, n, args, false, true);
356368
LOG_DEBUG("Converted split op into a list of IValues");
357369
return true;
358370
}})

docs/_cpp_api/class_view_hierarchy.html

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,26 @@
294294
</span>
295295
</span>
296296
</li>
297+
<li class="md-nav__item">
298+
<a class="md-nav__link" href="../_notebooks/CitriNet-example.html">
299+
Torch-TensorRT Getting Started - CitriNet
300+
</a>
301+
</li>
302+
<li class="md-nav__item">
303+
<a class="md-nav__link" href="../_notebooks/dynamic-shapes.html">
304+
Torch-TensorRT - Using Dynamic Shapes
305+
</a>
306+
</li>
307+
<li class="md-nav__item">
308+
<a class="md-nav__link" href="../_notebooks/EfficientNet-example.html">
309+
Torch-TensorRT Getting Started - EfficientNet-B0
310+
</a>
311+
</li>
312+
<li class="md-nav__item">
313+
<a class="md-nav__link" href="../_notebooks/Hugging-Face-BERT.html">
314+
Masked Language Modeling (MLM) with Hugging Face BERT Transformer
315+
</a>
316+
</li>
297317
<li class="md-nav__item">
298318
<a class="md-nav__link" href="../_notebooks/lenet-getting-started.html">
299319
Torch-TensorRT Getting Started - LeNet
@@ -314,16 +334,6 @@
314334
Deploying Quantization Aware Trained models in INT8 using Torch-TensorRT
315335
</a>
316336
</li>
317-
<li class="md-nav__item">
318-
<a class="md-nav__link" href="../_notebooks/EfficientNet-example.html">
319-
Torch-TensorRT Getting Started - EfficientNet-B0
320-
</a>
321-
</li>
322-
<li class="md-nav__item">
323-
<a class="md-nav__link" href="../_notebooks/dynamic-shapes.html">
324-
Torch-TensorRT - Using Dynamic Shapes
325-
</a>
326-
</li>
327337
<li class="md-nav__item">
328338
<span class="md-nav__link caption">
329339
<span class="caption-text">

docs/_cpp_api/classtorch__tensorrt_1_1DataType.html

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,26 @@
301301
</span>
302302
</span>
303303
</li>
304+
<li class="md-nav__item">
305+
<a class="md-nav__link" href="../_notebooks/CitriNet-example.html">
306+
Torch-TensorRT Getting Started - CitriNet
307+
</a>
308+
</li>
309+
<li class="md-nav__item">
310+
<a class="md-nav__link" href="../_notebooks/dynamic-shapes.html">
311+
Torch-TensorRT - Using Dynamic Shapes
312+
</a>
313+
</li>
314+
<li class="md-nav__item">
315+
<a class="md-nav__link" href="../_notebooks/EfficientNet-example.html">
316+
Torch-TensorRT Getting Started - EfficientNet-B0
317+
</a>
318+
</li>
319+
<li class="md-nav__item">
320+
<a class="md-nav__link" href="../_notebooks/Hugging-Face-BERT.html">
321+
Masked Language Modeling (MLM) with Hugging Face BERT Transformer
322+
</a>
323+
</li>
304324
<li class="md-nav__item">
305325
<a class="md-nav__link" href="../_notebooks/lenet-getting-started.html">
306326
Torch-TensorRT Getting Started - LeNet
@@ -321,16 +341,6 @@
321341
Deploying Quantization Aware Trained models in INT8 using Torch-TensorRT
322342
</a>
323343
</li>
324-
<li class="md-nav__item">
325-
<a class="md-nav__link" href="../_notebooks/EfficientNet-example.html">
326-
Torch-TensorRT Getting Started - EfficientNet-B0
327-
</a>
328-
</li>
329-
<li class="md-nav__item">
330-
<a class="md-nav__link" href="../_notebooks/dynamic-shapes.html">
331-
Torch-TensorRT - Using Dynamic Shapes
332-
</a>
333-
</li>
334344
<li class="md-nav__item">
335345
<span class="md-nav__link caption">
336346
<span class="caption-text">

docs/_cpp_api/classtorch__tensorrt_1_1Device_1_1DeviceType.html

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,26 @@
301301
</span>
302302
</span>
303303
</li>
304+
<li class="md-nav__item">
305+
<a class="md-nav__link" href="../_notebooks/CitriNet-example.html">
306+
Torch-TensorRT Getting Started - CitriNet
307+
</a>
308+
</li>
309+
<li class="md-nav__item">
310+
<a class="md-nav__link" href="../_notebooks/dynamic-shapes.html">
311+
Torch-TensorRT - Using Dynamic Shapes
312+
</a>
313+
</li>
314+
<li class="md-nav__item">
315+
<a class="md-nav__link" href="../_notebooks/EfficientNet-example.html">
316+
Torch-TensorRT Getting Started - EfficientNet-B0
317+
</a>
318+
</li>
319+
<li class="md-nav__item">
320+
<a class="md-nav__link" href="../_notebooks/Hugging-Face-BERT.html">
321+
Masked Language Modeling (MLM) with Hugging Face BERT Transformer
322+
</a>
323+
</li>
304324
<li class="md-nav__item">
305325
<a class="md-nav__link" href="../_notebooks/lenet-getting-started.html">
306326
Torch-TensorRT Getting Started - LeNet
@@ -321,16 +341,6 @@
321341
Deploying Quantization Aware Trained models in INT8 using Torch-TensorRT
322342
</a>
323343
</li>
324-
<li class="md-nav__item">
325-
<a class="md-nav__link" href="../_notebooks/EfficientNet-example.html">
326-
Torch-TensorRT Getting Started - EfficientNet-B0
327-
</a>
328-
</li>
329-
<li class="md-nav__item">
330-
<a class="md-nav__link" href="../_notebooks/dynamic-shapes.html">
331-
Torch-TensorRT - Using Dynamic Shapes
332-
</a>
333-
</li>
334344
<li class="md-nav__item">
335345
<span class="md-nav__link caption">
336346
<span class="caption-text">

docs/_cpp_api/classtorch__tensorrt_1_1TensorFormat.html

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,26 @@
301301
</span>
302302
</span>
303303
</li>
304+
<li class="md-nav__item">
305+
<a class="md-nav__link" href="../_notebooks/CitriNet-example.html">
306+
Torch-TensorRT Getting Started - CitriNet
307+
</a>
308+
</li>
309+
<li class="md-nav__item">
310+
<a class="md-nav__link" href="../_notebooks/dynamic-shapes.html">
311+
Torch-TensorRT - Using Dynamic Shapes
312+
</a>
313+
</li>
314+
<li class="md-nav__item">
315+
<a class="md-nav__link" href="../_notebooks/EfficientNet-example.html">
316+
Torch-TensorRT Getting Started - EfficientNet-B0
317+
</a>
318+
</li>
319+
<li class="md-nav__item">
320+
<a class="md-nav__link" href="../_notebooks/Hugging-Face-BERT.html">
321+
Masked Language Modeling (MLM) with Hugging Face BERT Transformer
322+
</a>
323+
</li>
304324
<li class="md-nav__item">
305325
<a class="md-nav__link" href="../_notebooks/lenet-getting-started.html">
306326
Torch-TensorRT Getting Started - LeNet
@@ -321,16 +341,6 @@
321341
Deploying Quantization Aware Trained models in INT8 using Torch-TensorRT
322342
</a>
323343
</li>
324-
<li class="md-nav__item">
325-
<a class="md-nav__link" href="../_notebooks/EfficientNet-example.html">
326-
Torch-TensorRT Getting Started - EfficientNet-B0
327-
</a>
328-
</li>
329-
<li class="md-nav__item">
330-
<a class="md-nav__link" href="../_notebooks/dynamic-shapes.html">
331-
Torch-TensorRT - Using Dynamic Shapes
332-
</a>
333-
</li>
334344
<li class="md-nav__item">
335345
<span class="md-nav__link caption">
336346
<span class="caption-text">

0 commit comments

Comments
 (0)