Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
8d70e2a3
Commit
8d70e2a3
authored
Sep 28, 2018
by
shssf
Committed by
Robert Kimball
Sep 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IntelGPU backend: Avoid scalar to matrix operation in clDNN (#1715)
parent
43b91a57
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
2 deletions
+41
-2
intelgpu_backend.cpp
src/ngraph/runtime/intelgpu/intelgpu_backend.cpp
+3
-2
backend_test.in.cpp
test/backend_test.in.cpp
+38
-0
No files found.
src/ngraph/runtime/intelgpu/intelgpu_backend.cpp
View file @
8d70e2a3
...
...
@@ -626,8 +626,9 @@ bool runtime::intelgpu::IntelGPUBackend::compile(shared_ptr<Function> func)
{
do_equal_propagation
(
topology
,
get_input_name
(
op
),
get_output_name
(
op
));
}
else
if
(
get_input_shape
(
op
).
empty
()
||
(
get_input_shape
(
op
).
size
()
==
1
&&
get_input_shape
(
op
).
at
(
0
)
==
1
))
else
if
(
get_input_type
(
op
)
!=
element
::
i32
&&
get_input_type
(
op
)
!=
element
::
i64
&&
((
get_input_shape
(
op
).
size
()
==
1
&&
get_input_shape
(
op
).
at
(
0
)
==
1
)
||
get_input_shape
(
op
).
empty
()))
{
const
cldnn
::
tensor
output_tensor_size
=
intelgpu_space
::
create_cldnn_tensor
(
get_output_shape
(
op
));
...
...
test/backend_test.in.cpp
View file @
8d70e2a3
...
...
@@ -2091,6 +2091,44 @@ NGRAPH_TEST(${BACKEND_NAME}, broadcast_vector_rowwise_int64)
EXPECT_EQ
((
vector
<
int64_t
>
{
1
,
2
,
3
,
4
,
1
,
2
,
3
,
4
,
1
,
2
,
3
,
4
}),
read_vector
<
int64_t
>
(
result
));
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
broadcast_scalar_to_matrix_int64
)
{
Shape
shape_a
{
1
};
auto
A
=
make_shared
<
op
::
Parameter
>
(
element
::
i64
,
shape_a
);
Shape
shape_r
{
3
,
1
};
auto
f
=
make_shared
<
Function
>
(
make_shared
<
op
::
Broadcast
>
(
A
,
shape_r
,
AxisSet
{
0
}),
op
::
ParameterVector
{
A
});
auto
backend
=
runtime
::
Backend
::
create
(
"${BACKEND_NAME}"
);
// Create some tensors for input/output
auto
a
=
backend
->
create_tensor
(
element
::
i64
,
shape_a
);
copy_data
(
a
,
vector
<
int64_t
>
{
4
});
auto
result
=
backend
->
create_tensor
(
element
::
i64
,
shape_r
);
backend
->
call_with_validate
(
f
,
{
result
},
{
a
});
EXPECT_EQ
((
vector
<
int64_t
>
{
4
,
4
,
4
}),
read_vector
<
int64_t
>
(
result
));
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
broadcast_scalar_to_matrix_int32
)
{
Shape
shape_a
{
1
};
auto
A
=
make_shared
<
op
::
Parameter
>
(
element
::
i32
,
shape_a
);
Shape
shape_r
{
3
,
1
};
auto
f
=
make_shared
<
Function
>
(
make_shared
<
op
::
Broadcast
>
(
A
,
shape_r
,
AxisSet
{
0
}),
op
::
ParameterVector
{
A
});
auto
backend
=
runtime
::
Backend
::
create
(
"${BACKEND_NAME}"
);
// Create some tensors for input/output
auto
a
=
backend
->
create_tensor
(
element
::
i32
,
shape_a
);
copy_data
(
a
,
vector
<
int32_t
>
{
4
});
auto
result
=
backend
->
create_tensor
(
element
::
i32
,
shape_r
);
backend
->
call_with_validate
(
f
,
{
result
},
{
a
});
EXPECT_EQ
((
vector
<
int32_t
>
{
4
,
4
,
4
}),
read_vector
<
int32_t
>
(
result
));
}
static
void
broadcast_test_helper
(
const
Shape
&
shape_a
,
const
Shape
&
shape_r
,
const
AxisSet
&
axis
)
{
auto
A
=
make_shared
<
op
::
Parameter
>
(
element
::
f32
,
shape_a
);
...
...
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