Commit d37b30ad authored by Louis Feng's avatar Louis Feng

clang format.

parent 78c57f10
...@@ -2404,9 +2404,11 @@ namespace ngraph ...@@ -2404,9 +2404,11 @@ namespace ngraph
auto& mkldnn_emitter = external_function->get_mkldnn_emitter(); auto& mkldnn_emitter = external_function->get_mkldnn_emitter();
auto data_desc = mkldnn_emitter->build_memory_descriptor(data, data_format); auto data_desc = mkldnn_emitter->build_memory_descriptor(data, data_format);
auto weights_desc = mkldnn_emitter->build_memory_descriptor(weights, weights_format); auto weights_desc =
mkldnn_emitter->build_memory_descriptor(weights, weights_format);
auto bias_desc = mkldnn_emitter->build_memory_descriptor(bias, bias_format); auto bias_desc = mkldnn_emitter->build_memory_descriptor(bias, bias_format);
auto result_desc = mkldnn_emitter->build_memory_descriptor(result, result_format); auto result_desc =
mkldnn_emitter->build_memory_descriptor(result, result_format);
// For dilation, MKLDNN wants to know how many elements to insert between, not how far // For dilation, MKLDNN wants to know how many elements to insert between, not how far
// apart to space the elements like nGraph. So we have to subtract 1 from each pos. // apart to space the elements like nGraph. So we have to subtract 1 from each pos.
...@@ -2449,7 +2451,8 @@ namespace ngraph ...@@ -2449,7 +2451,8 @@ namespace ngraph
template <> template <>
void CPU_Emitter::EMITTER_DECL(ngraph::op::ConvolutionBiasBackpropFiltersBias) void CPU_Emitter::EMITTER_DECL(ngraph::op::ConvolutionBiasBackpropFiltersBias)
{ {
auto convolution = static_cast<const ngraph::op::ConvolutionBiasBackpropFiltersBias*>(node); auto convolution =
static_cast<const ngraph::op::ConvolutionBiasBackpropFiltersBias*>(node);
const TensorViewWrapper& data = args[0]; const TensorViewWrapper& data = args[0];
const TensorViewWrapper& delta = args[1]; const TensorViewWrapper& delta = args[1];
const TensorViewWrapper& weights_delta = out[0]; const TensorViewWrapper& weights_delta = out[0];
...@@ -2473,8 +2476,10 @@ namespace ngraph ...@@ -2473,8 +2476,10 @@ namespace ngraph
auto& mkldnn_emitter = external_function->get_mkldnn_emitter(); auto& mkldnn_emitter = external_function->get_mkldnn_emitter();
auto data_desc = mkldnn_emitter->build_memory_descriptor(data, data_format); auto data_desc = mkldnn_emitter->build_memory_descriptor(data, data_format);
auto delta_desc = mkldnn_emitter->build_memory_descriptor(delta, delta_format); auto delta_desc = mkldnn_emitter->build_memory_descriptor(delta, delta_format);
auto weights_delta_desc = mkldnn_emitter->build_memory_descriptor(weights_delta, weights_delta_format); auto weights_delta_desc = mkldnn_emitter->build_memory_descriptor(
auto bias_delta_desc = mkldnn_emitter->build_memory_descriptor(bias_delta, bias_delta_format); weights_delta, weights_delta_format);
auto bias_delta_desc =
mkldnn_emitter->build_memory_descriptor(bias_delta, bias_delta_format);
size_t conv_index = mkldnn_emitter->build_convolution_backward_weights_bias( size_t conv_index = mkldnn_emitter->build_convolution_backward_weights_bias(
data_desc, data_desc,
...@@ -2501,7 +2506,8 @@ namespace ngraph ...@@ -2501,7 +2506,8 @@ namespace ngraph
} }
else else
{ {
throw ngraph_error("ConvolutionBiasBackpropFiltersBias is only supported with MKLDNN kernel."); throw ngraph_error(
"ConvolutionBiasBackpropFiltersBias is only supported with MKLDNN kernel.");
} }
} }
......
...@@ -141,14 +141,15 @@ size_t MKLDNNEmitter::build_convolution_forward(const mkldnn::memory::desc& inpu ...@@ -141,14 +141,15 @@ size_t MKLDNNEmitter::build_convolution_forward(const mkldnn::memory::desc& inpu
return conv_index; return conv_index;
} }
size_t MKLDNNEmitter::build_convolution_backward_weights_bias(const mkldnn::memory::desc &in_data_desc, size_t MKLDNNEmitter::build_convolution_backward_weights_bias(
const mkldnn::memory::desc &in_delta_desc, const mkldnn::memory::desc& in_data_desc,
const mkldnn::memory::desc &out_weights_delta_desc, const mkldnn::memory::desc& in_delta_desc,
const mkldnn::memory::desc &out_bias_delta_desc, const mkldnn::memory::desc& out_weights_delta_desc,
const ngraph::Strides &ng_strides, const mkldnn::memory::desc& out_bias_delta_desc,
const ngraph::Strides &ng_dilation_strides, const ngraph::Strides& ng_strides,
const ngraph::CoordinateDiff &ng_padding_below, const ngraph::Strides& ng_dilation_strides,
const ngraph::CoordinateDiff &ng_padding_above) const ngraph::CoordinateDiff& ng_padding_below,
const ngraph::CoordinateDiff& ng_padding_above)
{ {
const size_t in_data_index = build_memory_primitive(in_data_desc); const size_t in_data_index = build_memory_primitive(in_data_desc);
const size_t in_delta_index = build_memory_primitive(in_delta_desc); const size_t in_delta_index = build_memory_primitive(in_delta_desc);
...@@ -172,7 +173,8 @@ size_t MKLDNNEmitter::build_convolution_backward_weights_bias(const mkldnn::memo ...@@ -172,7 +173,8 @@ size_t MKLDNNEmitter::build_convolution_backward_weights_bias(const mkldnn::memo
mkldnn::padding_kind::zero}, mkldnn::padding_kind::zero},
mkldnn_utils::global_cpu_engine}; mkldnn_utils::global_cpu_engine};
mkldnn::convolution_backward_weights::primitive_desc bwd_pd{{mkldnn::algorithm::convolution_direct, mkldnn::convolution_backward_weights::primitive_desc bwd_pd{
{mkldnn::algorithm::convolution_direct,
in_data_desc, in_data_desc,
out_weights_delta_desc, out_weights_delta_desc,
out_bias_delta_desc, out_bias_delta_desc,
...@@ -185,13 +187,15 @@ size_t MKLDNNEmitter::build_convolution_backward_weights_bias(const mkldnn::memo ...@@ -185,13 +187,15 @@ size_t MKLDNNEmitter::build_convolution_backward_weights_bias(const mkldnn::memo
mkldnn_utils::global_cpu_engine, mkldnn_utils::global_cpu_engine,
fwd_pd}; fwd_pd};
const size_t conv_index = insert_primitive(new mkldnn::convolution_backward_weights(bwd_pd, const size_t conv_index = insert_primitive(
new mkldnn::convolution_backward_weights(bwd_pd,
*m_mkldnn_primitives[in_data_index], *m_mkldnn_primitives[in_data_index],
*m_mkldnn_primitives[in_delta_index], *m_mkldnn_primitives[in_delta_index],
*m_mkldnn_primitives[out_weights_delta_index], *m_mkldnn_primitives[out_weights_delta_index],
*m_mkldnn_primitives[out_bias_delta_index])); *m_mkldnn_primitives[out_bias_delta_index]));
m_primitive_deps[conv_index] = {in_data_index, in_delta_index, out_weights_delta_index, out_bias_delta_index}; m_primitive_deps[conv_index] = {
in_data_index, in_delta_index, out_weights_delta_index, out_bias_delta_index};
return conv_index; return conv_index;
} }
......
...@@ -90,14 +90,15 @@ namespace ngraph ...@@ -90,14 +90,15 @@ namespace ngraph
/** /**
* Convolution + bias backprop for weights and bias * Convolution + bias backprop for weights and bias
*/ */
size_t build_convolution_backward_weights_bias(const mkldnn::memory::desc &in_data_desc, size_t build_convolution_backward_weights_bias(
const mkldnn::memory::desc &in_delta_desc, const mkldnn::memory::desc& in_data_desc,
const mkldnn::memory::desc &out_weights_delta_desc, const mkldnn::memory::desc& in_delta_desc,
const mkldnn::memory::desc &out_bias_delta_desc, const mkldnn::memory::desc& out_weights_delta_desc,
const ngraph::Strides &ng_strides, const mkldnn::memory::desc& out_bias_delta_desc,
const ngraph::Strides &ng_dilation_strides, const ngraph::Strides& ng_strides,
const ngraph::CoordinateDiff &ng_padding_below, const ngraph::Strides& ng_dilation_strides,
const ngraph::CoordinateDiff &ng_padding_above); const ngraph::CoordinateDiff& ng_padding_below,
const ngraph::CoordinateDiff& ng_padding_above);
size_t build_pooling_forward(mkldnn::algorithm pooling_algorithm, size_t build_pooling_forward(mkldnn::algorithm pooling_algorithm,
const mkldnn::memory::desc& input_desc, const mkldnn::memory::desc& input_desc,
const mkldnn::memory::desc& result_desc, const mkldnn::memory::desc& result_desc,
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#include <numeric> #include <numeric>
#include "ngraph/ops/convolution.hpp" #include "ngraph/ops/convolution.hpp"
#include "ngraph/runtime/cpu/ops/conv_bias.hpp"
#include "ngraph/ops/get_output_element.hpp" #include "ngraph/ops/get_output_element.hpp"
#include "ngraph/runtime/cpu/ops/conv_bias.hpp"
#include "ngraph/util.hpp" #include "ngraph/util.hpp"
using namespace std; using namespace std;
...@@ -99,7 +99,8 @@ void op::ConvolutionBias::generate_adjoints(autodiff::Adjoints& adjoints, ...@@ -99,7 +99,8 @@ void op::ConvolutionBias::generate_adjoints(autodiff::Adjoints& adjoints,
m_padding_above, m_padding_above,
m_data_dilation_strides)); m_data_dilation_strides));
auto filter_bias_backprop = std::make_shared<op::ConvolutionBiasBackpropFiltersBias>(data, auto filter_bias_backprop =
std::make_shared<op::ConvolutionBiasBackpropFiltersBias>(data,
filter_shape, filter_shape,
bias_shape, bias_shape,
delta, delta,
...@@ -144,7 +145,8 @@ op::ConvolutionBiasBackpropFiltersBias::ConvolutionBiasBackpropFiltersBias( ...@@ -144,7 +145,8 @@ op::ConvolutionBiasBackpropFiltersBias::ConvolutionBiasBackpropFiltersBias(
if (data_batch_et != output_delta_et) if (data_batch_et != output_delta_et)
{ {
throw ngraph_error( throw ngraph_error(
"ConvolutionBiasBackpropFilterBias data batch and output delta element types do not match"); "ConvolutionBiasBackpropFilterBias data batch and output delta element types do not "
"match");
} }
// Forward Backward // Forward Backward
...@@ -173,8 +175,8 @@ op::ConvolutionBiasBackpropFiltersBias::ConvolutionBiasBackpropFiltersBias( ...@@ -173,8 +175,8 @@ op::ConvolutionBiasBackpropFiltersBias::ConvolutionBiasBackpropFiltersBias(
add_output(data_batch_et, bias_shape); add_output(data_batch_et, bias_shape);
} }
std::shared_ptr<Node> op::ConvolutionBiasBackpropFiltersBias::copy_with_new_args( std::shared_ptr<Node>
const NodeVector& new_args) const op::ConvolutionBiasBackpropFiltersBias::copy_with_new_args(const NodeVector& new_args) const
{ {
if (new_args.size() != 2) if (new_args.size() != 2)
{ {
......
...@@ -38,7 +38,8 @@ namespace ngraph ...@@ -38,7 +38,8 @@ namespace ngraph
std::shared_ptr<Node> get_bias() { return get_input_op(2); } 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_filters() { return get_input_op(1); }
std::shared_ptr<Node> get_data_batch() { return get_input_op(0); } std::shared_ptr<Node> get_data_batch() { return get_input_op(0); }
virtual std::shared_ptr<Node> copy_with_new_args(const NodeVector& new_args) const override; virtual std::shared_ptr<Node>
copy_with_new_args(const NodeVector& new_args) const override;
void generate_adjoints(autodiff::Adjoints& adjoints, void generate_adjoints(autodiff::Adjoints& adjoints,
const std::shared_ptr<Node>& delta) override; const std::shared_ptr<Node>& delta) override;
...@@ -76,7 +77,8 @@ namespace ngraph ...@@ -76,7 +77,8 @@ namespace ngraph
const CoordinateDiff& padding_above_forward, const CoordinateDiff& padding_above_forward,
const Strides& data_dilation_strides_forward); const Strides& data_dilation_strides_forward);
virtual std::shared_ptr<Node> copy_with_new_args(const NodeVector& new_args) const override; virtual std::shared_ptr<Node>
copy_with_new_args(const NodeVector& new_args) const override;
/// \return The filters tensor shape. /// \return The filters tensor shape.
const Shape& get_filters_shape() const { return m_filters_shape; } const Shape& get_filters_shape() const { return m_filters_shape; }
......
...@@ -195,7 +195,8 @@ namespace ngraph ...@@ -195,7 +195,8 @@ namespace ngraph
data_dilated = data_dilated || (s != 1); data_dilated = data_dilated || (s != 1);
} }
if (!data_dilated && data_rank == 4 && delta_rank == 4 && node->get_input_element_type(0) == element::f32) if (!data_dilated && data_rank == 4 && delta_rank == 4 &&
node->get_input_element_type(0) == element::f32)
{ {
auto op_annotations = auto op_annotations =
std::make_shared<ngraph::runtime::cpu::CPUOpAnnotations>(); std::make_shared<ngraph::runtime::cpu::CPUOpAnnotations>();
......
...@@ -548,4 +548,3 @@ void ngraph::runtime::cpu::pass::CPUFusion::construct_conv_bias() ...@@ -548,4 +548,3 @@ void ngraph::runtime::cpu::pass::CPUFusion::construct_conv_bias()
auto m = std::make_shared<ngraph::pattern::Matcher>(p_conv_bias, callback); auto m = std::make_shared<ngraph::pattern::Matcher>(p_conv_bias, callback);
this->add_matcher(m); this->add_matcher(m);
} }
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <memory> #include <memory>
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/file_util.hpp"
#include "ngraph/graph_util.hpp" #include "ngraph/graph_util.hpp"
#include "ngraph/log.hpp" #include "ngraph/log.hpp"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
...@@ -29,12 +30,11 @@ ...@@ -29,12 +30,11 @@
#include "ngraph/ops/sum.hpp" #include "ngraph/ops/sum.hpp"
#include "ngraph/pass/graph_rewrite.hpp" #include "ngraph/pass/graph_rewrite.hpp"
#include "ngraph/pass/manager.hpp" #include "ngraph/pass/manager.hpp"
#include "ngraph/pass/reshape_elimination.hpp"
#include "ngraph/pass/visualize_tree.hpp"
#include "ngraph/pattern/matcher.hpp" #include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/any.hpp" #include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp" #include "ngraph/pattern/op/label.hpp"
#include "ngraph/file_util.hpp"
#include "ngraph/pass/reshape_elimination.hpp"
#include "ngraph/pass/visualize_tree.hpp"
#include "ngraph/runtime/cpu/ops/conv_bias.hpp" #include "ngraph/runtime/cpu/ops/conv_bias.hpp"
#include "ngraph/runtime/cpu/ops/matmul_bias.hpp" #include "ngraph/runtime/cpu/ops/matmul_bias.hpp"
#include "ngraph/runtime/cpu/pass/cpu_fusion.hpp" #include "ngraph/runtime/cpu/pass/cpu_fusion.hpp"
...@@ -619,7 +619,8 @@ struct ConvolutionBiasTestData ...@@ -619,7 +619,8 @@ struct ConvolutionBiasTestData
shared_ptr<op::Parameter> bias; shared_ptr<op::Parameter> bias;
shared_ptr<op::Parameter> delta; shared_ptr<op::Parameter> delta;
void n1c1h3w3(shared_ptr<runtime::Backend> backend) { void n1c1h3w3(shared_ptr<runtime::Backend> backend)
{
n = 1; n = 1;
c = 1; c = 1;
filter = 1; filter = 1;
...@@ -633,47 +634,68 @@ struct ConvolutionBiasTestData ...@@ -633,47 +634,68 @@ struct ConvolutionBiasTestData
weights = make_shared<op::Parameter>(element::f32, weights_shape); weights = make_shared<op::Parameter>(element::f32, weights_shape);
bias_shape = Shape{filter}; bias_shape = Shape{filter};
bias = make_shared<op::Parameter>(element::f32, bias_shape); bias = make_shared<op::Parameter>(element::f32, bias_shape);
result_shape = Shape{n,filter,1,1}; result_shape = Shape{n, filter, 1, 1};
data_val = backend->make_primary_tensor_view(element::f32, data_shape); data_val = backend->make_primary_tensor_view(element::f32, data_shape);
copy_data(data_val, vector<float>{-0.67765152f, 0.10073948f, 0.57595438f, copy_data(data_val,
-0.3469252f, -0.22134334f, -1.80471897f, vector<float>{-0.67765152f,
-0.80642909f, 1.22033095f, 2.23235631f}); 0.10073948f,
0.57595438f,
-0.3469252f,
-0.22134334f,
-1.80471897f,
-0.80642909f,
1.22033095f,
2.23235631f});
weights_val = backend->make_primary_tensor_view(element::f32, weights_shape); weights_val = backend->make_primary_tensor_view(element::f32, weights_shape);
copy_data(weights_val, vector<float>{0.20070229f, -0.54968649f, -0.19819015f, copy_data(weights_val,
-0.38577855f, 1.37109005f, -0.23789984f, vector<float>{0.20070229f,
0.14867957f, -0.49851316f, -0.84815776f}); -0.54968649f,
-0.19819015f,
-0.38577855f,
1.37109005f,
-0.23789984f,
0.14867957f,
-0.49851316f,
-0.84815776f});
bias_val = backend->make_primary_tensor_view(element::f32, bias_shape); bias_val = backend->make_primary_tensor_view(element::f32, bias_shape);
copy_data(bias_val, vector<float>{0.07811152f}); copy_data(bias_val, vector<float>{0.07811152f});
result_val = backend->make_primary_tensor_view(element::f32, result_shape); result_val = backend->make_primary_tensor_view(element::f32, result_shape);
copy_data(result_val, vector<float>{0}); copy_data(result_val, vector<float>{0});
delta = make_shared<op::Parameter>(element::f32, result_shape); delta = make_shared<op::Parameter>(element::f32, result_shape);
delta_val = backend->make_primary_tensor_view(element::f32, result_shape); delta_val = backend->make_primary_tensor_view(element::f32, result_shape);
copy_data(delta_val, vector<float>{-2.58936238f}); copy_data(delta_val, vector<float>{-2.58936238f});
d_data_val = backend->make_primary_tensor_view(element::f32, data_shape); d_data_val = backend->make_primary_tensor_view(element::f32, data_shape);
copy_data(d_data_val, vector<float>{0,0,0, copy_data(d_data_val, vector<float>{0, 0, 0, 0, 0, 0, 0, 0, 0});
0,0,0,
0,0,0});
d_weights_val = backend->make_primary_tensor_view(element::f32, weights_shape); d_weights_val = backend->make_primary_tensor_view(element::f32, weights_shape);
copy_data(d_weights_val, vector<float>{0,0,0, copy_data(d_weights_val, vector<float>{0, 0, 0, 0, 0, 0, 0, 0, 0});
0,0,0,
0,0,0});
d_bias_val = backend->make_primary_tensor_view(element::f32, bias_shape); d_bias_val = backend->make_primary_tensor_view(element::f32, bias_shape);
copy_data(d_bias_val, vector<float>{0}); copy_data(d_bias_val, vector<float>{0});
expected_result_val = vector<float>{-2.58936238f}; expected_result_val = vector<float>{-2.58936238f};
expected_d_data_val = vector<float>{-0.51969099f, 1.42333758f, 0.5131861f, expected_d_data_val = vector<float>{-0.51969099f,
0.99892044f, -3.5502491f, 0.61600888f, 1.42333758f,
-0.3849853f, 1.29083121f, 2.19618773f}; 0.5131861f,
expected_d_weights_val = vector<float>{1.7546854f, -0.26085103f, -1.49135458f, 0.99892044f,
0.89831507f, 0.57313812f, 4.67307138f, -3.5502491f,
2.08813715f, -3.15987897f, -5.7803793f}; 0.61600888f,
-0.3849853f,
1.29083121f,
2.19618773f};
expected_d_weights_val = vector<float>{1.7546854f,
-0.26085103f,
-1.49135458f,
0.89831507f,
0.57313812f,
4.67307138f,
2.08813715f,
-3.15987897f,
-5.7803793f};
expected_d_bias_val = vector<float>{-2.58936238f}; expected_d_bias_val = vector<float>{-2.58936238f};
} }
}; };
...@@ -689,14 +711,17 @@ TEST(cpu_fusion, conv_bias_fprop_n1c1h3w3) ...@@ -689,14 +711,17 @@ TEST(cpu_fusion, conv_bias_fprop_n1c1h3w3)
auto convolution = make_shared<op::Convolution>(conv_test.data, conv_test.weights); auto convolution = make_shared<op::Convolution>(conv_test.data, conv_test.weights);
auto convolution_bias = make_shared<op::ConvolutionBias>(convolution, conv_test.bias); auto convolution_bias = make_shared<op::ConvolutionBias>(convolution, conv_test.bias);
auto f = make_shared<Function>(convolution_bias, op::ParameterVector{conv_test.data, conv_test.weights, conv_test.bias}); auto f = make_shared<Function>(
convolution_bias, op::ParameterVector{conv_test.data, conv_test.weights, conv_test.bias});
auto external = manager->compile(f); auto external = manager->compile(f);
auto cf = backend->make_call_frame(external); auto cf = backend->make_call_frame(external);
cf->call({conv_test.data_val, conv_test.weights_val, conv_test.bias_val}, {conv_test.result_val}); cf->call({conv_test.data_val, conv_test.weights_val, conv_test.bias_val},
{conv_test.result_val});
auto result_vec = read_vector<float>(conv_test.result_val); auto result_vec = read_vector<float>(conv_test.result_val);
EXPECT_TRUE(test::all_close(conv_test.expected_result_val, read_vector<float>(conv_test.result_val))); EXPECT_TRUE(
test::all_close(conv_test.expected_result_val, read_vector<float>(conv_test.result_val)));
} }
TEST(cpu_fusion, conv_bias_bprop_n1c1h3w3) TEST(cpu_fusion, conv_bias_bprop_n1c1h3w3)
...@@ -710,22 +735,27 @@ TEST(cpu_fusion, conv_bias_bprop_n1c1h3w3) ...@@ -710,22 +735,27 @@ TEST(cpu_fusion, conv_bias_bprop_n1c1h3w3)
auto convolution = make_shared<op::Convolution>(conv_test.data, conv_test.weights); auto convolution = make_shared<op::Convolution>(conv_test.data, conv_test.weights);
auto convolution_bias = make_shared<op::ConvolutionBias>(convolution, conv_test.bias); auto convolution_bias = make_shared<op::ConvolutionBias>(convolution, conv_test.bias);
auto f = make_shared<Function>(convolution_bias, op::ParameterVector{conv_test.data, conv_test.weights, conv_test.bias}); auto f = make_shared<Function>(
convolution_bias, op::ParameterVector{conv_test.data, conv_test.weights, conv_test.bias});
auto d_data = convolution_bias->backprop_node(conv_test.data, conv_test.delta); auto d_data = convolution_bias->backprop_node(conv_test.data, conv_test.delta);
auto d_weights = convolution_bias->backprop_node(conv_test.weights, conv_test.delta); auto d_weights = convolution_bias->backprop_node(conv_test.weights, conv_test.delta);
auto d_bias = convolution_bias->backprop_node(conv_test.bias, conv_test.delta); auto d_bias = convolution_bias->backprop_node(conv_test.bias, conv_test.delta);
auto df = make_shared<Function>(NodeVector{d_data, d_weights, d_bias}, auto df = make_shared<Function>(
NodeVector{d_data, d_weights, d_bias},
op::ParameterVector{conv_test.data, conv_test.weights, conv_test.bias, conv_test.delta}); op::ParameterVector{conv_test.data, conv_test.weights, conv_test.bias, conv_test.delta});
auto external = manager->compile(df); auto external = manager->compile(df);
auto cf = backend->make_call_frame(external); auto cf = backend->make_call_frame(external);
cf->call({conv_test.data_val, conv_test.weights_val, conv_test.bias_val, conv_test.delta_val}, {conv_test.d_data_val, conv_test.d_weights_val, conv_test.d_bias_val}); cf->call({conv_test.data_val, conv_test.weights_val, conv_test.bias_val, conv_test.delta_val},
{conv_test.d_data_val, conv_test.d_weights_val, conv_test.d_bias_val});
EXPECT_TRUE(test::all_close(conv_test.expected_d_data_val, read_vector<float>(conv_test.d_data_val))); EXPECT_TRUE(
EXPECT_TRUE(test::all_close(conv_test.expected_d_weights_val, read_vector<float>(conv_test.d_weights_val))); test::all_close(conv_test.expected_d_data_val, read_vector<float>(conv_test.d_data_val)));
EXPECT_TRUE(test::all_close(conv_test.expected_d_bias_val, read_vector<float>(conv_test.d_bias_val))); EXPECT_TRUE(test::all_close(conv_test.expected_d_weights_val,
read_vector<float>(conv_test.d_weights_val)));
EXPECT_TRUE(
test::all_close(conv_test.expected_d_bias_val, read_vector<float>(conv_test.d_bias_val)));
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment