Skip to content

Commit 2042ad1

Browse files
add comments and update readme
1 parent fdbca49 commit 2042ad1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Samples/BatchSupport/BatchSupport/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
7171
printf("model run took %d ticks\n", ticks);
7272

7373
// Print Results
74-
auto outputs = results.Outputs().Lookup(L"softmaxout_1").as<TensorFloat>();
74+
auto outputs = results.Outputs().Lookup(L"softmaxout_1").as<TensorFloat>(); // Get outputs by output name
7575
auto outputShape = outputs.Shape();
7676
printf("output dimensions [%d, %d, %d, %d]\n", outputShape.GetAt(0), outputShape.GetAt(1), outputShape.GetAt(2), outputShape.GetAt(3));
7777
SampleHelper::PrintResults(outputs.GetAsVectorView());

Samples/BatchSupport/readme.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,16 @@ Take binding batches of VideoFrame as example:
9393
9494
// Bind
9595
binding.Bind(inputFeatureDescriptor.Current().Name(), inputVideoFrames);
96+
```
97+
98+
### 3. Bind Outputs(optional)
99+
100+
The sample does not bind the output, but you could also bind the output as below:
101+
```C++
102+
auto outputShape = std::vector<int64_t>{BATCH_SIZE, 1000, 1, 1};
103+
auto outputValue = TensorFloat::Create(outputShape);
104+
std::wstring outputDataBindingName =
105+
std::wstring(model.OutputFeatures().First().Current().Name());
106+
binding.Bind(outputDataBindingName, outputValue);
107+
SampleHelper::PrintResults(outputValue.GetAsVectorView()); // Print Results
96108
```

0 commit comments

Comments
 (0)