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
070b958e
Commit
070b958e
authored
Aug 30, 2017
by
Scott Cyphers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style
parent
4aa19e31
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
28 deletions
+25
-28
ngraph.hpp
src/ngraph/ngraph.hpp
+1
-1
broadcast.hpp
src/ngraph/ops/broadcast.hpp
+0
-1
dot.hpp
src/ngraph/ops/dot.hpp
+0
-1
broadcast.cpp
src/ops/broadcast.cpp
+24
-25
No files found.
src/ngraph/ngraph.hpp
View file @
070b958e
...
...
@@ -24,9 +24,9 @@
#include "ngraph/node.hpp"
#include "ngraph/op.hpp"
#include "ngraph/ops/broadcast.hpp"
#include "ngraph/ops/dot.hpp"
#include "ngraph/ops/concatenate.hpp"
#include "ngraph/ops/constant.hpp"
#include "ngraph/ops/dot.hpp"
#include "ngraph/ops/parameter.hpp"
#include "ngraph/ops/tuple.hpp"
#include "ngraph/shape.hpp"
...
...
src/ngraph/ops/broadcast.hpp
View file @
070b958e
...
...
@@ -45,6 +45,5 @@ namespace ngraph
Node
::
ptr
broadcast
(
const
Node
::
ptr
&
tensor
,
const
Shape
&
shape
,
const
std
::
vector
<
size_t
>&
broadcast_axes
);
}
}
src/ngraph/ops/dot.hpp
View file @
070b958e
...
...
@@ -16,7 +16,6 @@
namespace
ngraph
{
class
DotOp
:
public
BuiltinOp
{
public
:
...
...
src/ops/broadcast.cpp
View file @
070b958e
...
...
@@ -23,36 +23,35 @@ using namespace ngraph;
** /param broadcast_axes The axis positions (0-based) in the result that are being broadcast.
** the remaining axes in shape must be the same as the shape of arg.
**/
Node
::
ptr
ngraph
::
op
::
broadcast
(
const
Node
::
ptr
&
tensor
,
Node
::
ptr
ngraph
::
op
::
broadcast
(
const
Node
::
ptr
&
tensor
,
const
Shape
&
shape
,
const
vector
<
size_t
>&
broadcast_axes
)
{
return
make_shared
<
BroadcastOp
>
(
tensor
,
shape
,
broadcast_axes
);
return
make_shared
<
BroadcastOp
>
(
tensor
,
shape
,
broadcast_axes
);
}
void
BroadcastOp
::
propagate_types
()
{
auto
arg_type
=
m_arguments
.
at
(
0
)
->
type
();
if
(
nullptr
==
arg_type
)
{
throw
ngraph_error
(
"Argument to broadcast is missing type."
);
}
auto
arg_tensor_view_type
=
dynamic_pointer_cast
<
TensorViewType
>
(
arg_type
);
if
(
nullptr
==
arg_tensor_view_type
)
{
throw
ngraph_error
(
"Argument to broadcast is not a tensor view"
);
}
vector
<
size_t
>
target_shape
=
m_shape
;
for
(
auto
i
=
m_broadcast_axes
.
rbegin
();
i
!=
m_broadcast_axes
.
rend
();
++
i
)
{
target_shape
.
erase
(
target_shape
.
begin
()
+
*
i
);
auto
arg_type
=
m_arguments
.
at
(
0
)
->
type
();
if
(
nullptr
==
arg_type
)
{
throw
ngraph_error
(
"Argument to broadcast is missing type."
);
}
auto
arg_tensor_view_type
=
dynamic_pointer_cast
<
TensorViewType
>
(
arg_type
);
if
(
nullptr
==
arg_tensor_view_type
)
{
throw
ngraph_error
(
"Argument to broadcast is not a tensor view"
);
}
vector
<
size_t
>
target_shape
=
m_shape
;
for
(
auto
i
=
m_broadcast_axes
.
rbegin
();
i
!=
m_broadcast_axes
.
rend
();
++
i
)
{
target_shape
.
erase
(
target_shape
.
begin
()
+
*
i
);
}
if
(
Shape
{
target_shape
}
!=
arg_tensor_view_type
->
shape
())
{
throw
ngraph_error
(
"Broadcast arg, shape, and axes are incompatible"
);
}
// TODO If m_type is already set (by framework), this should verify that the type
// we expect is consistent with the type the framework expects.
m_type
=
make_shared
<
TensorViewType
>
(
arg_tensor_view_type
->
element_type
(),
m_shape
);
}
if
(
Shape
{
target_shape
}
!=
arg_tensor_view_type
->
shape
())
{
throw
ngraph_error
(
"Broadcast arg, shape, and axes are incompatible"
);
}
// TODO If m_type is already set (by framework), this should verify that the type
// we expect is consistent with the type the framework expects.
m_type
=
make_shared
<
TensorViewType
>
(
arg_tensor_view_type
->
element_type
(),
m_shape
);
}
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