Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
da23619a
Commit
da23619a
authored
Nov 15, 2019
by
T.J. Mercier
Committed by
Tianqi Chen
Nov 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add check to ensure input file was successfully opened in NNVM deploy code demo (#4315)
parent
888a3c35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
docs/deploy/nnvm.md
+6
-2
No files found.
docs/deploy/nnvm.md
View file @
da23619a
...
...
@@ -59,9 +59,11 @@ An example in c++.
#include <tvm/runtime/registry.h>
#include <tvm/runtime/packed_func.h>
#include <algorithm>
#include <fstream>
#include <iterator>
#include <algorithm>
#include <stdexcept>
#include <string>
int
main
()
{
...
...
@@ -97,7 +99,9 @@ int main()
int64_t
in_shape
[
4
]
=
{
1
,
3
,
224
,
224
};
TVMArrayAlloc
(
in_shape
,
in_ndim
,
dtype_code
,
dtype_bits
,
dtype_lanes
,
device_type
,
device_id
,
&
x
);
// load image data saved in binary
std
::
ifstream
data_fin
(
"cat.bin"
,
std
::
ios
::
binary
);
const
std
::
string
data_filename
=
"cat.bin"
;
std
::
ifstream
data_fin
(
data_filename
,
std
::
ios
::
binary
);
if
(
!
data_fin
)
throw
std
::
runtime_error
(
"Could not open: "
+
data_filename
);
data_fin
.
read
(
static_cast
<
char
*>
(
x
->
data
),
3
*
224
*
224
*
4
);
// get the function from the module(set input data)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment