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
b56c44fe
Commit
b56c44fe
authored
Nov 02, 2018
by
Adam Procter
Committed by
Robert Kimball
Nov 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update add_delta_to_slice to tolerate dynamic shapes (#1962)
parent
b00530a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
adjoints.cpp
src/ngraph/autodiff/adjoints.cpp
+3
-2
element_type.cpp
src/ngraph/type/element_type.cpp
+5
-0
element_type.hpp
src/ngraph/type/element_type.hpp
+5
-0
No files found.
src/ngraph/autodiff/adjoints.cpp
View file @
b56c44fe
...
...
@@ -177,8 +177,9 @@ void autodiff::Adjoints::add_delta_to_slice(const std::shared_ptr<Node>& x,
const
Coordinate
&
upper_bounds
,
const
Strides
&
strides
)
{
if
(
x
->
get_output_element_type
(
0
)
!=
delta
->
get_output_element_type
(
0
)
||
x
->
get_output_shape
(
0
).
size
()
!=
delta
->
get_output_shape
(
0
).
size
())
if
(
!
(
x
->
get_output_element_type
(
0
).
compatible
(
delta
->
get_output_element_type
(
0
)))
||
!
(
x
->
get_output_partial_shape
(
0
).
rank
().
compatible
(
delta
->
get_output_partial_shape
(
0
).
rank
())))
{
throw
ngraph_error
(
"Autodiff internal error: Mismatch on backprop and op in add_delta_to_slice."
);
...
...
src/ngraph/type/element_type.cpp
View file @
b56c44fe
...
...
@@ -192,6 +192,11 @@ std::ostream& element::operator<<(std::ostream& out, const element::Type& obj)
return
out
;
}
bool
element
::
Type
::
compatible
(
element
::
Type
t
)
const
{
return
(
is_dynamic
()
||
t
.
is_dynamic
()
||
*
this
==
t
);
}
bool
element
::
Type
::
merge
(
element
::
Type
&
dst
,
const
element
::
Type
&
t1
,
const
element
::
Type
&
t2
)
{
if
(
t1
.
is_dynamic
())
...
...
src/ngraph/type/element_type.hpp
View file @
b56c44fe
...
...
@@ -77,6 +77,11 @@ namespace ngraph
/// Returns true if the type is floating point, else false.
bool
get_is_real
()
const
{
return
m_is_real
;
}
/// \brief Checks whether this element type is merge-compatible with `t`.
/// \param t The element type to compare this element type to.
/// \return `true` if this element type is compatible with `t`, else `false`.
bool
compatible
(
element
::
Type
t
)
const
;
/// \brief Merges two element types t1 and t2, writing the result into dst and
/// returning true if successful, else returning false.
///
...
...
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