Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Mace
Commits
e3357e41
Commit
e3357e41
authored
7 years ago
by
李寅
Browse files
Options
Download
Email Patches
Plain Diff
Do nothing when resize image
parent
97603f1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mace/core/runtime/hexagon/hexagon_control_wrapper.cc
+0
-1
mace/core/runtime/hexagon/hexagon_control_wrapper.cc
mace/core/tensor.h
+10
-8
mace/core/tensor.h
with
10 additions
and
9 deletions
+10
-9
mace/core/runtime/hexagon/hexagon_control_wrapper.cc
+
0
-
1
View file @
e3357e41
...
...
@@ -62,7 +62,6 @@ bool HexagonControlWrapper::SetupGraph(const NetDef &net_def) {
// const node
std
::
thread
const_thread
([
&
]()
{
std
::
cout
<<
"thread function
\n
"
;
std
::
vector
<
hexagon_nn_const_node
>
const_node_list
;
for
(
const
ConstTensor
&
const_tensor
:
net_def
.
tensors
())
{
std
::
vector
<
int
>
tensor_shape
(
const_tensor
.
dims
().
begin
(),
...
...
This diff is collapsed.
Click to expand it.
mace/core/tensor.h
+
10
-
8
View file @
e3357e41
...
...
@@ -169,6 +169,7 @@ class Tensor {
inline
void
Resize
(
const
std
::
vector
<
index_t
>
&
shape
)
{
shape_
=
shape
;
image_shape_
.
clear
();
if
(
buffer_
!=
nullptr
)
{
MACE_CHECK
(
!
has_opencl_image
(),
"Cannot resize image, use ResizeImage."
);
buffer_
->
Resize
(
raw_size
());
...
...
@@ -181,24 +182,25 @@ class Tensor {
inline
void
ResizeImage
(
const
std
::
vector
<
index_t
>
&
shape
,
const
std
::
vector
<
size_t
>
&
image_shape
)
{
shape_
=
shape
;
image_shape_
=
image_shape
;
if
(
buffer_
==
nullptr
)
{
buffer_
=
new
Image
(
image_shape
,
dtype_
);
is_buffer_owner_
=
true
;
}
else
{
MACE_CHECK
(
has_opencl_image
(),
"Cannot ResizeImage buffer, use Resize."
);
Image
*
image
=
dynamic_cast
<
Image
*>
(
buffer_
);
MACE_CHECK
(
shape
[
0
]
<=
image
->
image_shape
()[
0
]
&&
shape
[
1
]
<=
image
->
image_shape
()[
1
],
MACE_CHECK
(
image_
shape
[
0
]
<=
image
->
image_shape
()[
0
]
&&
image_
shape
[
1
]
<=
image
->
image_shape
()[
1
],
"tensor (source op "
,
name_
,
"): current image shape: "
,
"): current
physical
image shape: "
,
image
->
image_shape
()[
0
],
", "
,
image
->
image_shape
()[
1
],
" <
resize tensor
shape: "
,
shape
[
0
],
" <
logical image
shape: "
,
image_
shape
[
0
],
", "
,
shape
[
1
]);
image_
shape
[
1
]);
}
}
...
...
@@ -212,8 +214,7 @@ class Tensor {
delete
buffer_
;
buffer_
=
nullptr
;
}
ResizeImage
(
other
->
shape
(),
dynamic_cast
<
Image
*>
(
other
->
UnderlyingBuffer
())
->
image_shape
());
ResizeImage
(
other
->
shape
(),
other
->
image_shape_
);
}
else
{
if
(
is_buffer_owner_
&&
buffer_
!=
nullptr
&&
has_opencl_image
())
{
delete
buffer_
;
...
...
@@ -307,6 +308,7 @@ class Tensor {
Allocator
*
allocator_
;
DataType
dtype_
;
std
::
vector
<
index_t
>
shape_
;
std
::
vector
<
size_t
>
image_shape_
;
BufferBase
*
buffer_
;
BufferSlice
buffer_slice_
;
bool
is_buffer_owner_
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help