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
68ea2c3e
Commit
68ea2c3e
authored
Mar 04, 2018
by
Chris Nuernberger
Committed by
Tianqi Chen
Mar 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactor for clarity in arraycopyfromto (#960)
parent
0d6cf0c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
src/runtime/c_runtime_api.cc
+15
-12
No files found.
src/runtime/c_runtime_api.cc
View file @
68ea2c3e
...
...
@@ -413,19 +413,22 @@ int TVMArrayCopyFromTo(TVMArrayHandle from,
size_t
from_size
=
GetDataSize
(
from
);
size_t
to_size
=
GetDataSize
(
to
);
CHECK_EQ
(
from_size
,
to_size
)
<<
"TVMArrayCopyFromTo: The size must exactly match"
;
TVMContext
ctx
=
from
->
ctx
;
if
(
ctx
.
device_type
==
kDLCPU
)
{
ctx
=
to
->
ctx
;
}
else
{
CHECK
(
to
->
ctx
.
device_type
==
kDLCPU
||
to
->
ctx
.
device_type
==
from
->
ctx
.
device_type
)
<<
"Can not copy across different ctx types directly"
;
}
<<
"TVMArrayCopyFromTo: The size must exactly match"
;
CHECK
(
from
->
ctx
.
device_type
==
to
->
ctx
.
device_type
||
from
->
ctx
.
device_type
==
kDLCPU
||
to
->
ctx
.
device_type
==
kDLCPU
)
<<
"Can not copy across different ctx types directly"
;
// Use the context that is *not* a cpu context to get the correct device
// api manager.
TVMContext
ctx
=
from
->
ctx
.
device_type
!=
kDLCPU
?
from
->
ctx
:
to
->
ctx
;
DeviceAPIManager
::
Get
(
ctx
)
->
CopyDataFromTo
(
from
->
data
,
static_cast
<
size_t
>
(
from
->
byte_offset
),
to
->
data
,
static_cast
<
size_t
>
(
to
->
byte_offset
),
from_size
,
from
->
ctx
,
to
->
ctx
,
stream
);
from
->
data
,
static_cast
<
size_t
>
(
from
->
byte_offset
),
to
->
data
,
static_cast
<
size_t
>
(
to
->
byte_offset
),
from_size
,
from
->
ctx
,
to
->
ctx
,
stream
);
API_END
();
}
...
...
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