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
3d1c2fe0
Unverified
Commit
3d1c2fe0
authored
Feb 06, 2018
by
Matthew Brookhart
Committed by
GitHub
Feb 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into jbobba/mkldnn-outlining
parents
770b8cc6
c3364269
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
1 deletion
+69
-1
maximum.hpp
src/ngraph/ops/maximum.hpp
+1
-0
matmul_bias.cpp
src/ngraph/runtime/cpu/ops/matmul_bias.cpp
+1
-1
CMakeLists.txt
test/CMakeLists.txt
+2
-0
argon_fusion.cpp
test/argon_fusion.cpp
+65
-0
No files found.
src/ngraph/ops/maximum.hpp
View file @
3d1c2fe0
...
...
@@ -54,6 +54,7 @@ namespace ngraph
return
std
::
make_shared
<
Maximum
>
(
new_args
.
at
(
0
),
new_args
.
at
(
1
));
}
virtual
bool
is_commutative
()
override
{
return
true
;
}
protected
:
virtual
void
generate_adjoints
(
autodiff
::
Adjoints
&
adjoints
,
const
std
::
shared_ptr
<
Node
>&
delta
)
override
;
...
...
src/ngraph/runtime/cpu/ops/matmul_bias.cpp
View file @
3d1c2fe0
...
...
@@ -35,7 +35,7 @@ ngraph::op::MatmulBias::MatmulBias(std::shared_ptr<ngraph::Node> W,
Shape
shape_x
,
bool
transpose_w
,
bool
transpose_x
)
:
RequiresTensorViewArgs
(
"
CblassGemm
"
,
{
W
,
x
,
b
})
:
RequiresTensorViewArgs
(
"
MatMulBias
"
,
{
W
,
x
,
b
})
,
m_shape_w
(
shape_w
)
,
m_shape_x
(
shape_x
)
,
m_transpose_w
(
transpose_w
)
...
...
test/CMakeLists.txt
View file @
3d1c2fe0
...
...
@@ -88,7 +88,9 @@ if(NGRAPH_GPU_ENABLE AND LLVM_INCLUDE_DIR)
endif
()
if
(
NGRAPH_ARGON_ENABLE
)
include_directories
(
SYSTEM
${
ARGON_TRANSFORMER_INCLUDE_DIR
}
)
set
(
BACKEND_NAMES
${
BACKEND_NAMES
}
"ARGON"
)
set
(
SRC
${
SRC
}
argon_fusion.cpp
)
endif
()
foreach
(
BACKEND_NAME
${
BACKEND_NAMES
}
)
...
...
test/argon_fusion.cpp
0 → 100644
View file @
3d1c2fe0
// ----------------------------------------------------------------------------
// Copyright 2018 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <list>
#include <memory>
#include "gtest/gtest.h"
#include "ngraph/graph_util.hpp"
#include "ngraph/log.hpp"
#include "ngraph/ngraph.hpp"
#include "ngraph/ops/sum.hpp"
#include "ngraph/pass/graph_rewrite.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp"
//
#include "ngraph/file_util.hpp"
#include "ngraph/json.hpp"
#include "ngraph/runtime/argon/ops/relu.hpp"
#include "ngraph/runtime/argon/pass/argon_fusion.hpp"
#include "ngraph/serializer.hpp"
#include "ngraph/util.hpp"
#include "util/matcher.hpp"
#include "util/test_tools.hpp"
using
namespace
ngraph
;
using
namespace
std
;
TEST
(
Argon_fusion
,
fuse_max_with_constant_zero_input_as_relu
)
{
auto
shape_a
=
Shape
{
1
,
5
};
auto
A
=
op
::
Constant
::
create
(
element
::
f32
,
shape_a
,
{
0
,
0
,
0
,
0
,
0
});
auto
B
=
make_shared
<
op
::
Parameter
>
(
element
::
f32
,
shape_a
);
auto
max
=
make_shared
<
op
::
Maximum
>
(
A
,
B
);
auto
shape_rt
=
Shape
{
1
,
5
};
auto
f
=
make_shared
<
Function
>
(
max
,
op
::
Parameters
{
B
});
auto
manager
=
runtime
::
Manager
::
get
(
"ARGON"
);
auto
external
=
manager
->
compile
(
f
);
auto
backend
=
manager
->
allocate_backend
();
auto
cf
=
backend
->
make_call_frame
(
external
);
auto
b
=
backend
->
make_primary_tensor_view
(
element
::
f32
,
shape_a
);
copy_data
(
b
,
vector
<
float
>
{
1
,
8
,
-
8
,
17
,
-
0.5
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
f32
,
shape_rt
);
vector
<
float
>
expected
{
1
,
8
,
0
,
17
,
0
};
cf
->
call
({
b
},
{
result
});
EXPECT_EQ
(
read_vector
<
float
>
(
result
),
expected
);
}
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