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
6d336670
Commit
6d336670
authored
Nov 29, 2017
by
Adam Procter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
De-Eigenize comparison ops
parent
3e80ef25
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
300 additions
and
72 deletions
+300
-72
equal.hpp
src/ngraph/runtime/kernel/equal.hpp
+38
-0
greater.hpp
src/ngraph/runtime/kernel/greater.hpp
+33
-0
greater_eq.hpp
src/ngraph/runtime/kernel/greater_eq.hpp
+33
-0
less.hpp
src/ngraph/runtime/kernel/less.hpp
+33
-0
less_eq.hpp
src/ngraph/runtime/kernel/less_eq.hpp
+33
-0
not_equal.hpp
src/ngraph/runtime/kernel/not_equal.hpp
+38
-0
external_function.cpp
src/ngraph/runtime/ngvm/external_function.cpp
+12
-12
equal.hpp
src/ngraph/runtime/ngvm/instruction/equal.hpp
+13
-7
greater.hpp
src/ngraph/runtime/ngvm/instruction/greater.hpp
+14
-10
greater_eq.hpp
src/ngraph/runtime/ngvm/instruction/greater_eq.hpp
+13
-17
less.hpp
src/ngraph/runtime/ngvm/instruction/less.hpp
+14
-10
less_eq.hpp
src/ngraph/runtime/ngvm/instruction/less_eq.hpp
+13
-7
not_equal.hpp
src/ngraph/runtime/ngvm/instruction/not_equal.hpp
+13
-9
No files found.
src/ngraph/runtime/kernel/equal.hpp
0 → 100644
View file @
6d336670
// ----------------------------------------------------------------------------
// Copyright 2017 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
// ----------------------------------------------------------------------------
#pragma once
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wfloat-equal"
namespace
ngraph
{
namespace
runtime
{
namespace
kernel
{
template
<
typename
T
>
void
equal
(
T
*
arg0
,
T
*
arg1
,
char
*
out
,
size_t
count
)
// FIXME: temporarily char not bool
{
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
out
[
i
]
=
arg0
[
i
]
==
arg1
[
i
];
}
}
}
}
}
#pragma clang diagnostic pop
src/ngraph/runtime/kernel/greater.hpp
0 → 100644
View file @
6d336670
// ----------------------------------------------------------------------------
// Copyright 2017 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
// ----------------------------------------------------------------------------
#pragma once
namespace
ngraph
{
namespace
runtime
{
namespace
kernel
{
template
<
typename
T
>
void
greater
(
T
*
arg0
,
T
*
arg1
,
char
*
out
,
size_t
count
)
// FIXME: temporarily char not bool
{
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
out
[
i
]
=
arg0
[
i
]
>
arg1
[
i
];
}
}
}
}
}
src/ngraph/runtime/kernel/greater_eq.hpp
0 → 100644
View file @
6d336670
// ----------------------------------------------------------------------------
// Copyright 2017 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
// ----------------------------------------------------------------------------
#pragma once
namespace
ngraph
{
namespace
runtime
{
namespace
kernel
{
template
<
typename
T
>
void
greater_eq
(
T
*
arg0
,
T
*
arg1
,
char
*
out
,
size_t
count
)
// FIXME: temporarily char not bool
{
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
out
[
i
]
=
arg0
[
i
]
>=
arg1
[
i
];
}
}
}
}
}
src/ngraph/runtime/kernel/less.hpp
0 → 100644
View file @
6d336670
// ----------------------------------------------------------------------------
// Copyright 2017 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
// ----------------------------------------------------------------------------
#pragma once
namespace
ngraph
{
namespace
runtime
{
namespace
kernel
{
template
<
typename
T
>
void
less
(
T
*
arg0
,
T
*
arg1
,
char
*
out
,
size_t
count
)
// FIXME: temporarily char not bool
{
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
out
[
i
]
=
arg0
[
i
]
<
arg1
[
i
];
}
}
}
}
}
src/ngraph/runtime/kernel/less_eq.hpp
0 → 100644
View file @
6d336670
// ----------------------------------------------------------------------------
// Copyright 2017 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
// ----------------------------------------------------------------------------
#pragma once
namespace
ngraph
{
namespace
runtime
{
namespace
kernel
{
template
<
typename
T
>
void
less_eq
(
T
*
arg0
,
T
*
arg1
,
char
*
out
,
size_t
count
)
// FIXME: temporarily char not bool
{
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
out
[
i
]
=
arg0
[
i
]
<=
arg1
[
i
];
}
}
}
}
}
src/ngraph/runtime/kernel/not_equal.hpp
0 → 100644
View file @
6d336670
// ----------------------------------------------------------------------------
// Copyright 2017 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
// ----------------------------------------------------------------------------
#pragma once
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wfloat-equal"
namespace
ngraph
{
namespace
runtime
{
namespace
kernel
{
template
<
typename
T
>
void
not_equal
(
T
*
arg0
,
T
*
arg1
,
char
*
out
,
size_t
count
)
// FIXME: temporarily char not bool
{
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
out
[
i
]
=
arg0
[
i
]
!=
arg1
[
i
];
}
}
}
}
}
#pragma clang diagnostic pop
src/ngraph/runtime/ngvm/external_function.cpp
View file @
6d336670
...
@@ -89,13 +89,13 @@
...
@@ -89,13 +89,13 @@
#include "ngraph/runtime/ngvm/instruction/cosh.hpp"
#include "ngraph/runtime/ngvm/instruction/cosh.hpp"
#include "ngraph/runtime/ngvm/instruction/divide.hpp"
#include "ngraph/runtime/ngvm/instruction/divide.hpp"
#include "ngraph/runtime/ngvm/eigen/dot.hpp"
#include "ngraph/runtime/ngvm/eigen/dot.hpp"
#include "ngraph/runtime/ngvm/
eige
n/equal.hpp"
#include "ngraph/runtime/ngvm/
instructio
n/equal.hpp"
#include "ngraph/runtime/ngvm/instruction/exp.hpp"
#include "ngraph/runtime/ngvm/instruction/exp.hpp"
#include "ngraph/runtime/ngvm/instruction/floor.hpp"
#include "ngraph/runtime/ngvm/instruction/floor.hpp"
#include "ngraph/runtime/ngvm/
eige
n/greater_eq.hpp"
#include "ngraph/runtime/ngvm/
instructio
n/greater_eq.hpp"
#include "ngraph/runtime/ngvm/
eigen/greater_than
.hpp"
#include "ngraph/runtime/ngvm/
instruction/greater
.hpp"
#include "ngraph/runtime/ngvm/
eige
n/less_eq.hpp"
#include "ngraph/runtime/ngvm/
instructio
n/less_eq.hpp"
#include "ngraph/runtime/ngvm/
eigen/less_than
.hpp"
#include "ngraph/runtime/ngvm/
instruction/less
.hpp"
#include "ngraph/runtime/ngvm/instruction/log.hpp"
#include "ngraph/runtime/ngvm/instruction/log.hpp"
#include "ngraph/runtime/ngvm/eigen/matrix_mult.hpp"
#include "ngraph/runtime/ngvm/eigen/matrix_mult.hpp"
#include "ngraph/runtime/ngvm/eigen/matrix_slice.hpp"
#include "ngraph/runtime/ngvm/eigen/matrix_slice.hpp"
...
@@ -106,7 +106,7 @@
...
@@ -106,7 +106,7 @@
#include "ngraph/runtime/ngvm/instruction/multiply.hpp"
#include "ngraph/runtime/ngvm/instruction/multiply.hpp"
#include "ngraph/runtime/ngvm/instruction/negate.hpp"
#include "ngraph/runtime/ngvm/instruction/negate.hpp"
#include "ngraph/runtime/ngvm/eigen/not.hpp"
#include "ngraph/runtime/ngvm/eigen/not.hpp"
#include "ngraph/runtime/ngvm/
eige
n/not_equal.hpp"
#include "ngraph/runtime/ngvm/
instructio
n/not_equal.hpp"
#include "ngraph/runtime/ngvm/instruction/power.hpp"
#include "ngraph/runtime/ngvm/instruction/power.hpp"
#include "ngraph/runtime/ngvm/eigen/reduce_matrix_columns.hpp"
#include "ngraph/runtime/ngvm/eigen/reduce_matrix_columns.hpp"
#include "ngraph/runtime/ngvm/eigen/reduce_matrix_rows.hpp"
#include "ngraph/runtime/ngvm/eigen/reduce_matrix_rows.hpp"
...
@@ -392,12 +392,12 @@ ExternalFunction::OpMap& ExternalFunction::get_op_map()
...
@@ -392,12 +392,12 @@ ExternalFunction::OpMap& ExternalFunction::get_op_map()
M_REGISTER_POLYMORPHIC_CONSTANT
);
M_REGISTER_POLYMORPHIC_CONSTANT
);
};
};
REGISTER_POLYMORPHIC_BINOP
(
op
::
Equal
,
eige
n
::
EqualInstruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
Equal
,
instructio
n
::
EqualInstruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
NotEqual
,
eige
n
::
NotEqualInstruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
NotEqual
,
instructio
n
::
NotEqualInstruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
Greater
,
eigen
::
GreaterThan
Instruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
Greater
,
instruction
::
Greater
Instruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
GreaterEq
,
eige
n
::
GreaterEqInstruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
GreaterEq
,
instructio
n
::
GreaterEqInstruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
Less
,
eigen
::
LessThan
Instruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
Less
,
instruction
::
Less
Instruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
LessEq
,
eige
n
::
LessEqInstruction
);
REGISTER_POLYMORPHIC_BINOP
(
op
::
LessEq
,
instructio
n
::
LessEqInstruction
);
REGISTER_POLYMORPHIC_TERNOP
(
op
::
Select
,
eigen
::
SelectInstruction
);
REGISTER_POLYMORPHIC_TERNOP
(
op
::
Select
,
eigen
::
SelectInstruction
);
...
...
src/ngraph/runtime/ngvm/
eige
n/equal.hpp
→
src/ngraph/runtime/ngvm/
instructio
n/equal.hpp
View file @
6d336670
...
@@ -14,8 +14,9 @@
...
@@ -14,8 +14,9 @@
#pragma once
#pragma once
#include "ngraph/runtime/kernel/equal.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/
eigen/
utils.hpp"
#include "ngraph/runtime/ngvm/utils.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/runtime/tensor_view.hpp"
...
@@ -25,13 +26,15 @@ namespace ngraph
...
@@ -25,13 +26,15 @@ namespace ngraph
{
{
namespace
ngvm
namespace
ngvm
{
{
namespace
eige
n
namespace
instructio
n
{
{
template
<
typename
ET
>
template
<
typename
ET
>
class
EqualInstruction
:
public
Instruction
class
EqualInstruction
:
public
Instruction
{
{
public
:
public
:
EqualInstruction
(
TensorViewInfo
arg0
,
TensorViewInfo
arg1
,
TensorViewInfo
out
)
EqualInstruction
(
const
TensorViewInfo
&
arg0
,
const
TensorViewInfo
&
arg1
,
const
TensorViewInfo
&
out
)
:
m_arg0
(
arg0
)
:
m_arg0
(
arg0
)
,
m_arg1
(
arg1
)
,
m_arg1
(
arg1
)
,
m_out
(
out
)
,
m_out
(
out
)
...
@@ -40,10 +43,13 @@ namespace ngraph
...
@@ -40,10 +43,13 @@ namespace ngraph
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
{
{
EigenArray1d
<
element
::
Bool
>
(
call_frame
,
m_out
)
=
typename
ET
::
type
*
arg0
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg0
);
(
EigenArray1d
<
ET
>
(
call_frame
,
m_arg0
)
==
typename
ET
::
type
*
arg1
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg1
);
EigenArray1d
<
ET
>
(
call_frame
,
m_arg1
))
char
*
out
=
get_tensor_data_ptr
<
element
::
Bool
>
(
call_frame
,
m_out
);
// FIXME: temporarily char not bool
.
template
cast
<
char
>
();
size_t
count
=
get_tensor_element_count
(
call_frame
,
m_arg0
);
kernel
::
equal
<
typename
ET
::
type
>
(
arg0
,
arg1
,
out
,
count
);
}
}
protected
:
protected
:
...
...
src/ngraph/runtime/ngvm/
eigen/greater_than
.hpp
→
src/ngraph/runtime/ngvm/
instruction/greater
.hpp
View file @
6d336670
...
@@ -14,8 +14,9 @@
...
@@ -14,8 +14,9 @@
#pragma once
#pragma once
#include "ngraph/runtime/kernel/greater.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/
eigen/
utils.hpp"
#include "ngraph/runtime/ngvm/utils.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/runtime/tensor_view.hpp"
...
@@ -25,15 +26,15 @@ namespace ngraph
...
@@ -25,15 +26,15 @@ namespace ngraph
{
{
namespace
ngvm
namespace
ngvm
{
{
namespace
eige
n
namespace
instructio
n
{
{
template
<
typename
ET
>
template
<
typename
ET
>
class
Greater
Than
Instruction
:
public
Instruction
class
GreaterInstruction
:
public
Instruction
{
{
public
:
public
:
Greater
ThanInstruction
(
TensorViewInfo
arg0
,
Greater
Instruction
(
const
TensorViewInfo
&
arg0
,
TensorViewInfo
arg1
,
const
TensorViewInfo
&
arg1
,
TensorViewInfo
out
)
const
TensorViewInfo
&
out
)
:
m_arg0
(
arg0
)
:
m_arg0
(
arg0
)
,
m_arg1
(
arg1
)
,
m_arg1
(
arg1
)
,
m_out
(
out
)
,
m_out
(
out
)
...
@@ -42,10 +43,13 @@ namespace ngraph
...
@@ -42,10 +43,13 @@ namespace ngraph
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
{
{
EigenArray1d
<
element
::
Bool
>
(
call_frame
,
m_out
)
=
typename
ET
::
type
*
arg0
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg0
);
(
EigenArray1d
<
ET
>
(
call_frame
,
m_arg0
)
>
typename
ET
::
type
*
arg1
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg1
);
EigenArray1d
<
ET
>
(
call_frame
,
m_arg1
))
char
*
out
=
get_tensor_data_ptr
<
element
::
Bool
>
(
call_frame
,
m_out
);
// FIXME: temporarily char not bool
.
template
cast
<
char
>
();
size_t
count
=
get_tensor_element_count
(
call_frame
,
m_arg0
);
kernel
::
greater
<
typename
ET
::
type
>
(
arg0
,
arg1
,
out
,
count
);
}
}
protected
:
protected
:
...
...
src/ngraph/runtime/ngvm/
eige
n/greater_eq.hpp
→
src/ngraph/runtime/ngvm/
instructio
n/greater_eq.hpp
View file @
6d336670
...
@@ -14,8 +14,9 @@
...
@@ -14,8 +14,9 @@
#pragma once
#pragma once
#include "ngraph/runtime/kernel/greater_eq.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/
eigen/
utils.hpp"
#include "ngraph/runtime/ngvm/utils.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/runtime/tensor_view.hpp"
...
@@ -25,23 +26,15 @@ namespace ngraph
...
@@ -25,23 +26,15 @@ namespace ngraph
{
{
namespace
ngvm
namespace
ngvm
{
{
namespace
eige
n
namespace
instructio
n
{
{
template
<
typename
TI
,
typename
TO
>
void
greater_eq
(
TI
arg0
,
TI
arg1
,
TO
out
)
{
auto
result_as_float
=
get_map_array
(
&*
arg0
)
<=
get_map_array
(
&*
arg1
);
auto
result_as_char
=
result_as_float
.
template
cast
<
char
>
();
set_map_array
(
&*
out
,
result_as_char
);
}
template
<
typename
ET
>
template
<
typename
ET
>
class
GreaterEqInstruction
:
public
Instruction
class
GreaterEqInstruction
:
public
Instruction
{
{
public
:
public
:
GreaterEqInstruction
(
TensorViewInfo
arg0
,
GreaterEqInstruction
(
const
TensorViewInfo
&
arg0
,
TensorViewInfo
arg1
,
const
TensorViewInfo
&
arg1
,
TensorViewInfo
out
)
const
TensorViewInfo
&
out
)
:
m_arg0
(
arg0
)
:
m_arg0
(
arg0
)
,
m_arg1
(
arg1
)
,
m_arg1
(
arg1
)
,
m_out
(
out
)
,
m_out
(
out
)
...
@@ -50,10 +43,13 @@ namespace ngraph
...
@@ -50,10 +43,13 @@ namespace ngraph
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
{
{
EigenArray1d
<
element
::
Bool
>
(
call_frame
,
m_out
)
=
typename
ET
::
type
*
arg0
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg0
);
(
EigenArray1d
<
ET
>
(
call_frame
,
m_arg0
)
>=
typename
ET
::
type
*
arg1
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg1
);
EigenArray1d
<
ET
>
(
call_frame
,
m_arg1
))
char
*
out
=
get_tensor_data_ptr
<
element
::
Bool
>
(
call_frame
,
m_out
);
// FIXME: temporarily char not bool
.
template
cast
<
char
>
();
size_t
count
=
get_tensor_element_count
(
call_frame
,
m_arg0
);
kernel
::
greater_eq
<
typename
ET
::
type
>
(
arg0
,
arg1
,
out
,
count
);
}
}
protected
:
protected
:
...
...
src/ngraph/runtime/ngvm/
eigen/less_than
.hpp
→
src/ngraph/runtime/ngvm/
instruction/less
.hpp
View file @
6d336670
...
@@ -14,8 +14,9 @@
...
@@ -14,8 +14,9 @@
#pragma once
#pragma once
#include "ngraph/runtime/kernel/less.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/
eigen/
utils.hpp"
#include "ngraph/runtime/ngvm/utils.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/runtime/tensor_view.hpp"
...
@@ -25,15 +26,15 @@ namespace ngraph
...
@@ -25,15 +26,15 @@ namespace ngraph
{
{
namespace
ngvm
namespace
ngvm
{
{
namespace
eige
n
namespace
instructio
n
{
{
template
<
typename
ET
>
template
<
typename
ET
>
class
Less
Than
Instruction
:
public
Instruction
class
LessInstruction
:
public
Instruction
{
{
public
:
public
:
Less
ThanInstruction
(
TensorViewInfo
arg0
,
Less
Instruction
(
const
TensorViewInfo
&
arg0
,
TensorViewInfo
arg1
,
const
TensorViewInfo
&
arg1
,
TensorViewInfo
out
)
const
TensorViewInfo
&
out
)
:
m_arg0
(
arg0
)
:
m_arg0
(
arg0
)
,
m_arg1
(
arg1
)
,
m_arg1
(
arg1
)
,
m_out
(
out
)
,
m_out
(
out
)
...
@@ -42,10 +43,13 @@ namespace ngraph
...
@@ -42,10 +43,13 @@ namespace ngraph
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
{
{
EigenArray1d
<
element
::
Bool
>
(
call_frame
,
m_out
)
=
typename
ET
::
type
*
arg0
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg0
);
(
EigenArray1d
<
ET
>
(
call_frame
,
m_arg0
)
<
typename
ET
::
type
*
arg1
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg1
);
EigenArray1d
<
ET
>
(
call_frame
,
m_arg1
))
char
*
out
=
get_tensor_data_ptr
<
element
::
Bool
>
(
call_frame
,
m_out
);
// FIXME: temporarily char not bool
.
template
cast
<
char
>
();
size_t
count
=
get_tensor_element_count
(
call_frame
,
m_arg0
);
kernel
::
less
<
typename
ET
::
type
>
(
arg0
,
arg1
,
out
,
count
);
}
}
protected
:
protected
:
...
...
src/ngraph/runtime/ngvm/
eige
n/less_eq.hpp
→
src/ngraph/runtime/ngvm/
instructio
n/less_eq.hpp
View file @
6d336670
...
@@ -14,8 +14,9 @@
...
@@ -14,8 +14,9 @@
#pragma once
#pragma once
#include "ngraph/runtime/kernel/less_eq.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/
eigen/
utils.hpp"
#include "ngraph/runtime/ngvm/utils.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/runtime/tensor_view.hpp"
...
@@ -25,13 +26,15 @@ namespace ngraph
...
@@ -25,13 +26,15 @@ namespace ngraph
{
{
namespace
ngvm
namespace
ngvm
{
{
namespace
eige
n
namespace
instructio
n
{
{
template
<
typename
ET
>
template
<
typename
ET
>
class
LessEqInstruction
:
public
Instruction
class
LessEqInstruction
:
public
Instruction
{
{
public
:
public
:
LessEqInstruction
(
TensorViewInfo
arg0
,
TensorViewInfo
arg1
,
TensorViewInfo
out
)
LessEqInstruction
(
const
TensorViewInfo
&
arg0
,
const
TensorViewInfo
&
arg1
,
const
TensorViewInfo
&
out
)
:
m_arg0
(
arg0
)
:
m_arg0
(
arg0
)
,
m_arg1
(
arg1
)
,
m_arg1
(
arg1
)
,
m_out
(
out
)
,
m_out
(
out
)
...
@@ -40,10 +43,13 @@ namespace ngraph
...
@@ -40,10 +43,13 @@ namespace ngraph
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
{
{
EigenArray1d
<
element
::
Bool
>
(
call_frame
,
m_out
)
=
typename
ET
::
type
*
arg0
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg0
);
(
EigenArray1d
<
ET
>
(
call_frame
,
m_arg0
)
<=
typename
ET
::
type
*
arg1
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg1
);
EigenArray1d
<
ET
>
(
call_frame
,
m_arg1
))
char
*
out
=
get_tensor_data_ptr
<
element
::
Bool
>
(
call_frame
,
m_out
);
// FIXME: temporarily char not bool
.
template
cast
<
char
>
();
size_t
count
=
get_tensor_element_count
(
call_frame
,
m_arg0
);
kernel
::
less_eq
<
typename
ET
::
type
>
(
arg0
,
arg1
,
out
,
count
);
}
}
protected
:
protected
:
...
...
src/ngraph/runtime/ngvm/
eige
n/not_equal.hpp
→
src/ngraph/runtime/ngvm/
instructio
n/not_equal.hpp
View file @
6d336670
...
@@ -14,8 +14,9 @@
...
@@ -14,8 +14,9 @@
#pragma once
#pragma once
#include "ngraph/runtime/kernel/not_equal.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/call_frame.hpp"
#include "ngraph/runtime/ngvm/
eigen/
utils.hpp"
#include "ngraph/runtime/ngvm/utils.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/ngvm/instruction.hpp"
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/runtime/tensor_view.hpp"
...
@@ -25,15 +26,15 @@ namespace ngraph
...
@@ -25,15 +26,15 @@ namespace ngraph
{
{
namespace
ngvm
namespace
ngvm
{
{
namespace
eige
n
namespace
instructio
n
{
{
template
<
typename
ET
>
template
<
typename
ET
>
class
NotEqualInstruction
:
public
Instruction
class
NotEqualInstruction
:
public
Instruction
{
{
public
:
public
:
NotEqualInstruction
(
TensorViewInfo
arg0
,
NotEqualInstruction
(
const
TensorViewInfo
&
arg0
,
TensorViewInfo
arg1
,
const
TensorViewInfo
&
arg1
,
TensorViewInfo
out
)
const
TensorViewInfo
&
out
)
:
m_arg0
(
arg0
)
:
m_arg0
(
arg0
)
,
m_arg1
(
arg1
)
,
m_arg1
(
arg1
)
,
m_out
(
out
)
,
m_out
(
out
)
...
@@ -42,10 +43,13 @@ namespace ngraph
...
@@ -42,10 +43,13 @@ namespace ngraph
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
virtual
void
execute
(
CallFrame
&
call_frame
)
const
override
{
{
EigenArray1d
<
element
::
Bool
>
(
call_frame
,
m_out
)
=
typename
ET
::
type
*
arg0
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg0
);
(
EigenArray1d
<
ET
>
(
call_frame
,
m_arg0
)
!=
typename
ET
::
type
*
arg1
=
get_tensor_data_ptr
<
ET
>
(
call_frame
,
m_arg1
);
EigenArray1d
<
ET
>
(
call_frame
,
m_arg1
))
char
*
out
=
get_tensor_data_ptr
<
element
::
Bool
>
(
call_frame
,
m_out
);
// FIXME: temporarily char not bool
.
template
cast
<
char
>
();
size_t
count
=
get_tensor_element_count
(
call_frame
,
m_arg0
);
kernel
::
not_equal
<
typename
ET
::
type
>
(
arg0
,
arg1
,
out
,
count
);
}
}
protected
:
protected
:
...
...
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