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
72493caf
Commit
72493caf
authored
Dec 16, 2019
by
baojun
Committed by
Sang Ik Lee
Dec 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set output element type for case of dynamic input (#4071)
* set output type * set output type
parent
415a852d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
partial_slice.cpp
src/ngraph/op/fused/partial_slice.cpp
+12
-1
softmax_crossentropy.cpp
src/ngraph/op/fused/softmax_crossentropy.cpp
+26
-0
softmax_crossentropy.hpp
src/ngraph/op/fused/softmax_crossentropy.hpp
+2
-0
No files found.
src/ngraph/op/fused/partial_slice.cpp
View file @
72493caf
...
...
@@ -132,12 +132,18 @@ shared_ptr<Node> op::PartialSlice::copy_with_new_args(const NodeVector& new_args
void
op
::
PartialSlice
::
pre_validate_and_infer_types
()
{
element
::
Type
input_element_type
=
get_input_element_type
(
0
);
PartialShape
data_pshape
=
get_input_partial_shape
(
0
);
NODE_VALIDATION_CHECK
(
this
,
input_element_type
.
is_dynamic
()
||
input_element_type
.
is_real
(),
"Argument element type must be f16, bf16, f32, f64 or dynamic (got "
,
input_element_type
,
")."
);
if
(
data_pshape
.
is_dynamic
())
{
set_output_type
(
0
,
input_element_type
,
PartialShape
::
dynamic
());
}
}
void
op
::
PartialSlice
::
generate_adjoints
(
autodiff
::
Adjoints
&
adjoints
,
const
OutputVector
&
deltas
)
...
...
@@ -222,11 +228,16 @@ shared_ptr<Node> op::PartialSliceBackprop::copy_with_new_args(const NodeVector&
void
op
::
PartialSliceBackprop
::
pre_validate_and_infer_types
()
{
element
::
Type
input_element_type
=
get_input_element_type
(
0
);
PartialShape
data_pshape
=
get_input_partial_shape
(
0
);
PartialShape
delta_pshape
=
get_input_partial_shape
(
1
);
NODE_VALIDATION_CHECK
(
this
,
input_element_type
.
is_dynamic
()
||
input_element_type
.
is_real
(),
"Argument element type must be f16, bf16, f32, f64 or dynamic (got "
,
input_element_type
,
")."
);
set_output_type
(
0
,
get_input_element_type
(
0
),
PartialShape
::
dynamic
());
if
(
data_pshape
.
is_dynamic
()
||
delta_pshape
.
is_dynamic
())
{
set_output_type
(
0
,
input_element_type
,
PartialShape
::
dynamic
());
}
}
src/ngraph/op/fused/softmax_crossentropy.cpp
View file @
72493caf
...
...
@@ -133,6 +133,24 @@ NodeVector op::SoftmaxCrossEntropy::decompose_op() const
}
}
void
op
::
SoftmaxCrossEntropy
::
pre_validate_and_infer_types
()
{
element
::
Type
input_element_type
=
get_input_element_type
(
0
);
PartialShape
data_pshape
=
get_input_partial_shape
(
0
);
PartialShape
labels_pshape
=
get_input_partial_shape
(
1
);
NODE_VALIDATION_CHECK
(
this
,
input_element_type
.
is_dynamic
()
||
input_element_type
.
is_real
(),
"Argument element type must be f16, bf16, f32, f64 or dynamic (got "
,
input_element_type
,
")."
);
if
(
data_pshape
.
is_dynamic
()
||
labels_pshape
.
is_dynamic
())
{
set_output_type
(
0
,
input_element_type
,
PartialShape
::
dynamic
());
}
}
shared_ptr
<
Node
>
op
::
SoftmaxCrossEntropy
::
copy_with_new_args
(
const
NodeVector
&
new_args
)
const
{
check_new_args_count
(
this
,
new_args
);
...
...
@@ -157,12 +175,20 @@ op::SoftmaxCrossEntropyBackprop::SoftmaxCrossEntropyBackprop(const Output<Node>&
void
op
::
SoftmaxCrossEntropyBackprop
::
pre_validate_and_infer_types
()
{
element
::
Type
input_element_type
=
get_input_element_type
(
0
);
PartialShape
delta_pshape
=
get_input_partial_shape
(
0
);
PartialShape
softmax_pshape
=
get_input_partial_shape
(
1
);
PartialShape
labels_pshape
=
get_input_partial_shape
(
2
);
NODE_VALIDATION_CHECK
(
this
,
input_element_type
.
is_dynamic
()
||
input_element_type
.
is_real
(),
"Argument element type must be f16, bf16, f32, f64 or dynamic (got "
,
input_element_type
,
")."
);
if
(
delta_pshape
.
is_dynamic
()
||
softmax_pshape
.
is_dynamic
()
||
labels_pshape
.
is_dynamic
())
{
set_output_type
(
0
,
input_element_type
,
PartialShape
::
dynamic
());
}
}
shared_ptr
<
Node
>
...
...
src/ngraph/op/fused/softmax_crossentropy.hpp
View file @
72493caf
...
...
@@ -48,6 +48,8 @@ namespace ngraph
virtual
NodeVector
decompose_op
()
const
override
;
void
pre_validate_and_infer_types
()
override
;
virtual
std
::
shared_ptr
<
Node
>
copy_with_new_args
(
const
NodeVector
&
new_args
)
const
override
;
...
...
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