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
5c0a29ee
Commit
5c0a29ee
authored
Feb 21, 2018
by
nikolay.korovaiko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conv_bias op
parent
233e4b1b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
0 deletions
+147
-0
CMakeLists.txt
src/ngraph/CMakeLists.txt
+1
-0
conv_bias.cpp
src/ngraph/runtime/cpu/ops/conv_bias.cpp
+82
-0
conv_bias.hpp
src/ngraph/runtime/cpu/ops/conv_bias.hpp
+64
-0
No files found.
src/ngraph/CMakeLists.txt
100644 → 100755
View file @
5c0a29ee
...
...
@@ -180,6 +180,7 @@ if (NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR AND
runtime/cpu/mkldnn_invoke.cpp
runtime/cpu/mkldnn_utils.cpp
runtime/cpu/ops/convert_layout.cpp
runtime/cpu/ops/conv_bias.cpp
runtime/cpu/ops/matmul_bias.cpp
runtime/cpu/pass/cpu_fusion.cpp
runtime/cpu/pass/cpu_layout.cpp
...
...
src/ngraph/runtime/cpu/ops/conv_bias.cpp
0 → 100644
View file @
5c0a29ee
/*******************************************************************************
* Copyright 2017-2018 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
#include <numeric>
#include "ngraph/runtime/cpu/ops/conv_bias.hpp"
#include "ngraph/util.hpp"
using
namespace
std
;
using
namespace
ngraph
;
op
::
ConvolutionBias
::
ConvolutionBias
(
const
std
::
shared_ptr
<
op
::
Convolution
>&
conv
,
const
std
::
shared_ptr
<
Node
>&
bias
)
:
RequiresTensorViewArgs
(
"ConvolutionBias"
,
{
conv
->
get_input_op
(
0
),
conv
->
get_input_op
(
1
),
bias
})
,
m_window_movement_strides
(
conv
->
get_window_movement_strides
())
,
m_window_dilation_strides
(
conv
->
get_window_dilation_strides
())
,
m_padding_below
(
conv
->
get_padding_below
())
,
m_padding_above
(
conv
->
get_padding_above
())
,
m_data_dilation_strides
(
conv
->
get_data_dilation_strides
())
{
if
(
conv
->
get_element_type
()
!=
bias
->
get_element_type
())
{
throw
ngraph_error
(
"Convolution's element type isn't equal to bias!"
);
}
set_value_type_checked
(
conv
->
get_element_type
(),
conv
->
get_shape
());
}
op
::
ConvolutionBias
::
ConvolutionBias
(
const
std
::
shared_ptr
<
Node
>&
data_batch
,
const
std
::
shared_ptr
<
Node
>&
filters
,
const
std
::
shared_ptr
<
Node
>&
bias
,
const
Strides
&
window_movement_strides
,
const
Strides
&
window_dilation_strides
,
const
CoordinateDiff
&
padding_below
,
const
CoordinateDiff
&
padding_above
,
const
Strides
&
data_dilation_strides
)
:
RequiresTensorViewArgs
(
"ConvolutionBias"
,
{
data_batch
,
filters
,
bias
})
,
m_window_movement_strides
(
window_movement_strides
)
,
m_window_dilation_strides
(
window_dilation_strides
)
,
m_padding_below
(
padding_below
)
,
m_padding_above
(
padding_above
)
,
m_data_dilation_strides
(
data_dilation_strides
)
{
}
std
::
shared_ptr
<
Node
>
op
::
ConvolutionBias
::
copy_with_new_args
(
const
std
::
vector
<
std
::
shared_ptr
<
Node
>>&
new_args
)
const
{
if
(
new_args
.
size
()
!=
2
)
{
throw
ngraph_error
(
"Incorrect number of new arguments"
);
}
return
std
::
shared_ptr
<
Node
>
(
new
ConvolutionBias
(
new_args
.
at
(
0
),
new_args
.
at
(
1
),
new_args
.
at
(
2
),
get_window_movement_strides
(),
get_window_dilation_strides
(),
get_padding_below
(),
get_padding_above
(),
get_data_dilation_strides
()));
}
void
op
::
ConvolutionBias
::
generate_adjoints
(
autodiff
::
Adjoints
&
adjoints
,
const
std
::
shared_ptr
<
Node
>&
delta
)
{
throw
ngraph_error
(
"Not implemented!"
);
}
src/ngraph/runtime/cpu/ops/conv_bias.hpp
0 → 100644
View file @
5c0a29ee
/*******************************************************************************
* Copyright 2017-2018 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
#pragma once
#include "ngraph/ops/convolution.hpp"
#include "ngraph/ops/util/requires_tensor_view_args.hpp"
namespace
ngraph
{
namespace
op
{
class
ConvolutionBias
:
public
util
::
RequiresTensorViewArgs
{
public
:
ConvolutionBias
(
const
std
::
shared_ptr
<
op
::
Convolution
>&
conv
,
const
std
::
shared_ptr
<
Node
>&
bias
);
const
Strides
&
get_window_movement_strides
()
const
{
return
m_window_movement_strides
;
}
const
Strides
&
get_window_dilation_strides
()
const
{
return
m_window_dilation_strides
;
}
const
CoordinateDiff
&
get_padding_below
()
const
{
return
m_padding_below
;
}
const
CoordinateDiff
&
get_padding_above
()
const
{
return
m_padding_above
;
}
const
Strides
&
get_data_dilation_strides
()
const
{
return
m_data_dilation_strides
;
}
std
::
shared_ptr
<
Node
>
get_bias
()
{
return
get_input_op
(
2
);
}
std
::
shared_ptr
<
Node
>
get_filters
()
{
return
get_input_op
(
1
);
}
std
::
shared_ptr
<
Node
>
get_data_batch
()
{
return
get_input_op
(
0
);
}
virtual
std
::
shared_ptr
<
Node
>
copy_with_new_args
(
const
std
::
vector
<
std
::
shared_ptr
<
Node
>>&
new_args
)
const
override
;
void
generate_adjoints
(
autodiff
::
Adjoints
&
adjoints
,
const
std
::
shared_ptr
<
Node
>&
delta
)
override
;
protected
:
Strides
m_window_movement_strides
;
Strides
m_window_dilation_strides
;
CoordinateDiff
m_padding_below
;
CoordinateDiff
m_padding_above
;
Strides
m_data_dilation_strides
;
private
:
ConvolutionBias
(
const
std
::
shared_ptr
<
Node
>&
data_batch
,
const
std
::
shared_ptr
<
Node
>&
filters
,
const
std
::
shared_ptr
<
Node
>&
bias
,
const
Strides
&
window_movement_strides
,
const
Strides
&
window_dilation_strides
,
const
CoordinateDiff
&
padding_below
,
const
CoordinateDiff
&
padding_above
,
const
Strides
&
data_dilation_strides
);
};
}
}
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