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
5f8bf07e
Commit
5f8bf07e
authored
Aug 27, 2017
by
Scott Cyphers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish implementation of type casting.
parent
689c22d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
type.hpp
src/ngraph/type.hpp
+6
-2
op.cpp
src/ops/op.cpp
+3
-3
No files found.
src/ngraph/type.hpp
View file @
5f8bf07e
...
...
@@ -39,8 +39,12 @@ namespace ngraph
using
ptr
=
std
::
shared_ptr
<
ValueType
>
;
virtual
~
ValueType
()
{}
virtual
std
::
shared_ptr
<
TensorViewType
>
as_tensor_view_type
()
{
return
nullptr
;
}
virtual
std
::
shared_ptr
<
TupleType
>
as_tuple_type
()
{
return
nullptr
;
}
/**
** Unmanaged cast to a supertype. dynamic_cast cannot be used
** directly on a shared_ptr.
**/
template
<
typename
T
>
T
as
()
{
return
dynamic_cast
<
T
>
(
this
);
}
};
/**
...
...
src/ops/op.cpp
View file @
5f8bf07e
...
...
@@ -55,7 +55,7 @@ void BroadcastCall::propagate_types()
{
throw
ngraph_error
(
"Argument to broadcast is missing type."
);
}
auto
arg_tensor_view_type
=
arg_type
->
as
_tensor_view_type
();
auto
arg_tensor_view_type
=
arg_type
->
as
<
TensorViewType
*>
();
if
(
nullptr
==
arg_tensor_view_type
)
{
throw
ngraph_error
(
"Argument to broadcast is not a tensor view"
);
...
...
@@ -103,8 +103,8 @@ Node::ptr ngraph::op::dot(const Node::ptr& arg0, const Node::ptr& arg1)
void
DotCall
::
propagate_types
()
{
auto
arg0_tensor_type
=
m_arguments
.
at
(
0
)
->
type
()
->
as
_tensor_view_type
();
auto
arg1_tensor_type
=
m_arguments
.
at
(
1
)
->
type
()
->
as
_tensor_view_type
();
auto
arg0_tensor_type
=
m_arguments
.
at
(
0
)
->
type
()
->
as
<
TensorViewType
*>
();
auto
arg1_tensor_type
=
m_arguments
.
at
(
1
)
->
type
()
->
as
<
TensorViewType
*>
();
if
(
nullptr
==
arg0_tensor_type
||
nullptr
==
arg1_tensor_type
)
{
throw
ngraph_error
(
"Arguments to dot must be tensor views"
);
...
...
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