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
1d919bfc
Commit
1d919bfc
authored
Nov 25, 2017
by
Robert Kimball
Committed by
Adam Procter
Nov 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make call_frame call a little more readable (#265)
parent
eebf0b70
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
128 additions
and
130 deletions
+128
-130
call_frame.hpp
src/ngraph/runtime/call_frame.hpp
+2
-2
call_frame.cpp
src/ngraph/runtime/cpu/call_frame.cpp
+2
-2
call_frame.hpp
src/ngraph/runtime/cpu/call_frame.hpp
+2
-3
call_frame.cpp
src/ngraph/runtime/ngvm/call_frame.cpp
+2
-2
call_frame.hpp
src/ngraph/runtime/ngvm/call_frame.hpp
+2
-3
call.hpp
src/ngraph/runtime/ngvm/eigen/call.hpp
+1
-1
reduce_matrix_columns.hpp
src/ngraph/runtime/ngvm/eigen/reduce_matrix_columns.hpp
+1
-1
reduce_matrix_rows.hpp
src/ngraph/runtime/ngvm/eigen/reduce_matrix_rows.hpp
+1
-1
reduce_to_scalar.hpp
src/ngraph/runtime/ngvm/eigen/reduce_to_scalar.hpp
+1
-1
backend_test.in.cpp
test/backend_test.in.cpp
+114
-114
No files found.
src/ngraph/runtime/call_frame.hpp
View file @
1d919bfc
...
@@ -36,8 +36,8 @@ namespace ngraph
...
@@ -36,8 +36,8 @@ namespace ngraph
///
///
/// Tuples will be expanded into their tensor views to build the call frame.
/// Tuples will be expanded into their tensor views to build the call frame.
virtual
void
virtual
void
operator
()
(
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
inputs
,
call
(
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
inputs
,
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
outputs
)
=
0
;
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
outputs
)
=
0
;
/// @brief Invoke the function with tuples pre-expanded to their underlying tensor views.
/// @brief Invoke the function with tuples pre-expanded to their underlying tensor views.
virtual
void
tensor_call
(
const
TensorViewPtrs
&
inputs
,
virtual
void
tensor_call
(
const
TensorViewPtrs
&
inputs
,
...
...
src/ngraph/runtime/cpu/call_frame.cpp
View file @
1d919bfc
...
@@ -50,8 +50,8 @@ void CallFrame::tensor_call(
...
@@ -50,8 +50,8 @@ void CallFrame::tensor_call(
m_compiled_function
(
inputs
.
data
(),
outputs
.
data
());
m_compiled_function
(
inputs
.
data
(),
outputs
.
data
());
}
}
void
CallFrame
::
operator
()
(
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
arguments
,
void
CallFrame
::
call
(
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
arguments
,
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
results
)
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
results
)
{
{
// TODO: Check types of args and result
// TODO: Check types of args and result
vector
<
shared_ptr
<
ngraph
::
runtime
::
TensorView
>>
inputs
;
vector
<
shared_ptr
<
ngraph
::
runtime
::
TensorView
>>
inputs
;
...
...
src/ngraph/runtime/cpu/call_frame.hpp
View file @
1d919bfc
...
@@ -47,9 +47,8 @@ namespace ngraph
...
@@ -47,9 +47,8 @@ namespace ngraph
/// @brief Invoke the function with values matching the signature of the function.
/// @brief Invoke the function with values matching the signature of the function.
///
///
/// Tuples will be expanded into their tensor views to build the call frame.
/// Tuples will be expanded into their tensor views to build the call frame.
void
void
call
(
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
inputs
,
operator
()(
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
inputs
,
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
outputs
);
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
outputs
);
/// @brief Invoke the function with tuples pre-expanded to their underlying
/// @brief Invoke the function with tuples pre-expanded to their underlying
/// tensor views.
/// tensor views.
...
...
src/ngraph/runtime/ngvm/call_frame.cpp
View file @
1d919bfc
...
@@ -63,8 +63,8 @@ void CallFrame::tensor_call(
...
@@ -63,8 +63,8 @@ void CallFrame::tensor_call(
fill_n
(
m_tensor_views
.
begin
(),
m_n_inputs
+
m_n_outputs
,
nullptr
);
fill_n
(
m_tensor_views
.
begin
(),
m_n_inputs
+
m_n_outputs
,
nullptr
);
}
}
void
CallFrame
::
operator
()
(
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
arguments
,
void
CallFrame
::
call
(
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
arguments
,
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
results
)
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
results
)
{
{
// TODO: Check types of args and result
// TODO: Check types of args and result
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
TensorView
>>
inputs
;
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
TensorView
>>
inputs
;
...
...
src/ngraph/runtime/ngvm/call_frame.hpp
View file @
1d919bfc
...
@@ -47,9 +47,8 @@ namespace ngraph
...
@@ -47,9 +47,8 @@ namespace ngraph
/// @brief Invoke the function with values matching the signature of the function.
/// @brief Invoke the function with values matching the signature of the function.
///
///
/// Tuples will be expanded into their tensor views to build the call frame.
/// Tuples will be expanded into their tensor views to build the call frame.
void
void
call
(
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
inputs
,
operator
()(
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
inputs
,
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
outputs
);
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
runtime
::
Value
>>&
outputs
);
/// @brief Invoke the function with tuples pre-expanded to their underlying tensor views.
/// @brief Invoke the function with tuples pre-expanded to their underlying tensor views.
void
tensor_call
(
const
TensorViewPtrs
&
inputs
,
const
TensorViewPtrs
&
outputs
);
void
tensor_call
(
const
TensorViewPtrs
&
inputs
,
const
TensorViewPtrs
&
outputs
);
...
...
src/ngraph/runtime/ngvm/eigen/call.hpp
View file @
1d919bfc
...
@@ -58,7 +58,7 @@ namespace ngraph
...
@@ -58,7 +58,7 @@ namespace ngraph
{
{
outputs
.
push_back
(
call_frame
.
get_tensor_view
(
out
.
get_index
()));
outputs
.
push_back
(
call_frame
.
get_tensor_view
(
out
.
get_index
()));
}
}
(
*
cf
)
(
inputs
,
outputs
);
cf
->
call
(
inputs
,
outputs
);
}
}
protected
:
protected
:
...
...
src/ngraph/runtime/ngvm/eigen/reduce_matrix_columns.hpp
View file @
1d919bfc
...
@@ -55,7 +55,7 @@ namespace ngraph
...
@@ -55,7 +55,7 @@ namespace ngraph
auto
ty
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{},
{
y
});
auto
ty
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{},
{
y
});
auto
tr
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{});
auto
tr
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{});
(
*
cf
)
({
tx
,
ty
},
{
tr
});
cf
->
call
({
tx
,
ty
},
{
tr
});
return
tr
->
get_vector
()[
0
];
return
tr
->
get_vector
()[
0
];
};
};
EigenVector
<
ET
>
(
call_frame
,
m_out
)
=
EigenVector
<
ET
>
(
call_frame
,
m_out
)
=
...
...
src/ngraph/runtime/ngvm/eigen/reduce_matrix_rows.hpp
View file @
1d919bfc
...
@@ -55,7 +55,7 @@ namespace ngraph
...
@@ -55,7 +55,7 @@ namespace ngraph
auto
ty
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{},
{
y
});
auto
ty
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{},
{
y
});
auto
tr
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{});
auto
tr
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{});
(
*
cf
)
({
tx
,
ty
},
{
tr
});
cf
->
call
({
tx
,
ty
},
{
tr
});
return
tr
->
get_vector
()[
0
];
return
tr
->
get_vector
()[
0
];
};
};
EigenVector
<
ET
>
(
call_frame
,
m_out
)
=
EigenVector
<
ET
>
(
call_frame
,
m_out
)
=
...
...
src/ngraph/runtime/ngvm/eigen/reduce_to_scalar.hpp
View file @
1d919bfc
...
@@ -55,7 +55,7 @@ namespace ngraph
...
@@ -55,7 +55,7 @@ namespace ngraph
auto
ty
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{},
{
y
});
auto
ty
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{},
{
y
});
auto
tr
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{});
auto
tr
=
ngraph
::
runtime
::
make_tensor
<
ET
>
(
Shape
{});
(
*
cf
)
({
tx
,
ty
},
{
tr
});
cf
->
call
({
tx
,
ty
},
{
tr
});
return
tr
->
get_vector
()[
0
];
return
tr
->
get_vector
()[
0
];
};
};
EigenArray1d
<
ET
>
(
call_frame
,
m_out
)
=
EigenArray1d
<
ET
>
(
call_frame
,
m_out
)
=
...
...
test/backend_test.in.cpp
View file @
1d919bfc
...
@@ -60,13 +60,13 @@ TEST(${BACKEND_NAME}, abc)
...
@@ -60,13 +60,13 @@ TEST(${BACKEND_NAME}, abc)
copy_data
(
b
,
runtime
::
NDArray
<
float
,
2
>
({{
5
,
6
},
{
7
,
8
}}).
get_vector
());
copy_data
(
b
,
runtime
::
NDArray
<
float
,
2
>
({{
5
,
6
},
{
7
,
8
}}).
get_vector
());
copy_data
(
c
,
runtime
::
NDArray
<
float
,
2
>
({{
9
,
10
},
{
11
,
12
}}).
get_vector
());
copy_data
(
c
,
runtime
::
NDArray
<
float
,
2
>
({{
9
,
10
},
{
11
,
12
}}).
get_vector
());
(
*
cf
)
({
a
,
b
,
c
},
{
result
});
cf
->
call
({
a
,
b
,
c
},
{
result
});
EXPECT_EQ
(
*
result
,
(
runtime
::
NDArray
<
float
,
2
>
({{
54
,
80
},
{
110
,
144
}})));
EXPECT_EQ
(
*
result
,
(
runtime
::
NDArray
<
float
,
2
>
({{
54
,
80
},
{
110
,
144
}})));
(
*
cf
)
({
b
,
a
,
c
},
{
result
});
cf
->
call
({
b
,
a
,
c
},
{
result
});
EXPECT_EQ
(
*
result
,
(
runtime
::
NDArray
<
float
,
2
>
({{
54
,
80
},
{
110
,
144
}})));
EXPECT_EQ
(
*
result
,
(
runtime
::
NDArray
<
float
,
2
>
({{
54
,
80
},
{
110
,
144
}})));
(
*
cf
)
({
a
,
c
,
b
},
{
result
});
cf
->
call
({
a
,
c
,
b
},
{
result
});
EXPECT_EQ
(
*
result
,
(
runtime
::
NDArray
<
float
,
2
>
({{
50
,
72
},
{
98
,
128
}})));
EXPECT_EQ
(
*
result
,
(
runtime
::
NDArray
<
float
,
2
>
({{
50
,
72
},
{
98
,
128
}})));
}
}
...
@@ -93,13 +93,13 @@ TEST(${BACKEND_NAME}, abc_int64)
...
@@ -93,13 +93,13 @@ TEST(${BACKEND_NAME}, abc_int64)
copy_data
(
c
,
vector
<
element
::
Int64
::
type
>
{
9
,
10
,
11
,
12
});
copy_data
(
c
,
vector
<
element
::
Int64
::
type
>
{
9
,
10
,
11
,
12
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
,
c
},
{
result
});
cf
->
call
({
a
,
b
,
c
},
{
result
});
EXPECT_EQ
((
vector
<
element
::
Int64
::
type
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
<
int64_t
>
());
EXPECT_EQ
((
vector
<
element
::
Int64
::
type
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
<
int64_t
>
());
(
*
cf
)
({
b
,
a
,
c
},
{
result
});
cf
->
call
({
b
,
a
,
c
},
{
result
});
EXPECT_EQ
((
vector
<
element
::
Int64
::
type
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
<
int64_t
>
());
EXPECT_EQ
((
vector
<
element
::
Int64
::
type
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
<
int64_t
>
());
(
*
cf
)
({
a
,
c
,
b
},
{
result
});
cf
->
call
({
a
,
c
,
b
},
{
result
});
EXPECT_EQ
((
vector
<
element
::
Int64
::
type
>
{
50
,
72
,
98
,
128
}),
result
->
get_vector
<
int64_t
>
());
EXPECT_EQ
((
vector
<
element
::
Int64
::
type
>
{
50
,
72
,
98
,
128
}),
result
->
get_vector
<
int64_t
>
());
}
}
...
@@ -137,13 +137,13 @@ TEST(${BACKEND_NAME}, abc_tuple)
...
@@ -137,13 +137,13 @@ TEST(${BACKEND_NAME}, abc_tuple)
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result_tuple
=
runtime
::
make_tuple
({
result
});
auto
result_tuple
=
runtime
::
make_tuple
({
result
});
(
*
cf
)
({
abc
},
{
result_tuple
});
cf
->
call
({
abc
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
float
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
<
float
>
());
(
*
cf
)
({
bac
},
{
result_tuple
});
cf
->
call
({
bac
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
float
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
<
float
>
());
(
*
cf
)
({
acb
},
{
result_tuple
});
cf
->
call
({
acb
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
float
>
{
50
,
72
,
98
,
128
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
50
,
72
,
98
,
128
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -181,15 +181,15 @@ TEST(${BACKEND_NAME}, abc_tuple_int64)
...
@@ -181,15 +181,15 @@ TEST(${BACKEND_NAME}, abc_tuple_int64)
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape
);
auto
result_tuple
=
runtime
::
make_tuple
({
result
});
auto
result_tuple
=
runtime
::
make_tuple
({
result
});
(
*
cf
)
({
abc
},
{
result_tuple
});
cf
->
call
({
abc
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
54
,
80
,
110
,
144
}),
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
<
element
::
Int64
::
type
>
());
result
->
get_vector
<
element
::
Int64
::
type
>
());
(
*
cf
)
({
bac
},
{
result_tuple
});
cf
->
call
({
bac
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
54
,
80
,
110
,
144
}),
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
<
element
::
Int64
::
type
>
());
result
->
get_vector
<
element
::
Int64
::
type
>
());
(
*
cf
)
({
acb
},
{
result_tuple
});
cf
->
call
({
acb
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
50
,
72
,
98
,
128
}),
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
50
,
72
,
98
,
128
}),
result
->
get_vector
<
element
::
Int64
::
type
>
());
result
->
get_vector
<
element
::
Int64
::
type
>
());
}
}
...
@@ -226,7 +226,7 @@ TEST(${BACKEND_NAME}, tuple_result)
...
@@ -226,7 +226,7 @@ TEST(${BACKEND_NAME}, tuple_result)
auto
r1
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
r1
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result_tuple
=
runtime
::
make_tuple
({
r0
,
r1
});
auto
result_tuple
=
runtime
::
make_tuple
({
r0
,
r1
});
(
*
cf
)
({
a
,
b
,
c
},
{
result_tuple
});
cf
->
call
({
a
,
b
,
c
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
float
>
{
6
,
8
,
10
,
12
}),
r0
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
6
,
8
,
10
,
12
}),
r0
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
54
,
80
,
110
,
144
}),
r1
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
54
,
80
,
110
,
144
}),
r1
->
get_vector
<
float
>
());
...
@@ -249,7 +249,7 @@ TEST(${BACKEND_NAME}, abs)
...
@@ -249,7 +249,7 @@ TEST(${BACKEND_NAME}, abs)
copy_data
(
a
,
vector
<
float
>
{
1
,
-
2
,
0
,
-
4.8
f
});
copy_data
(
a
,
vector
<
float
>
{
1
,
-
2
,
0
,
-
4.8
f
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
0
,
4.8
f
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
0
,
4.8
f
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -280,7 +280,7 @@ TEST(${BACKEND_NAME}, concat_matrix_colwise)
...
@@ -280,7 +280,7 @@ TEST(${BACKEND_NAME}, concat_matrix_colwise)
copy_data
(
c
,
vector
<
float
>
{
2
,
3
,
5
,
7
,
11
,
13
});
copy_data
(
c
,
vector
<
float
>
{
2
,
3
,
5
,
7
,
11
,
13
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
,
c
},
{
result
});
cf
->
call
({
a
,
b
,
c
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
2
,
4
,
1
,
2
,
4
,
2
,
3
,
5
,
8
,
16
,
8
,
16
,
32
,
7
,
11
,
13
}),
ASSERT_EQ
((
vector
<
float
>
{
2
,
4
,
1
,
2
,
4
,
2
,
3
,
5
,
8
,
16
,
8
,
16
,
32
,
7
,
11
,
13
}),
result
->
get_vector
<
float
>
());
result
->
get_vector
<
float
>
());
}
}
...
@@ -312,7 +312,7 @@ TEST(${BACKEND_NAME}, concat_matrix_rowwise)
...
@@ -312,7 +312,7 @@ TEST(${BACKEND_NAME}, concat_matrix_rowwise)
copy_data
(
c
,
vector
<
float
>
{
2
,
3
,
5
,
7
,
11
,
13
});
copy_data
(
c
,
vector
<
float
>
{
2
,
3
,
5
,
7
,
11
,
13
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
,
c
},
{
result
});
cf
->
call
({
a
,
b
,
c
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
2
,
4
,
8
,
16
,
1
,
2
,
4
,
8
,
16
,
32
,
2
,
3
,
5
,
7
,
11
,
13
}),
ASSERT_EQ
((
vector
<
float
>
{
2
,
4
,
8
,
16
,
1
,
2
,
4
,
8
,
16
,
32
,
2
,
3
,
5
,
7
,
11
,
13
}),
result
->
get_vector
<
float
>
());
result
->
get_vector
<
float
>
());
}
}
...
@@ -344,7 +344,7 @@ TEST(${BACKEND_NAME}, concat_matrix_int64)
...
@@ -344,7 +344,7 @@ TEST(${BACKEND_NAME}, concat_matrix_int64)
copy_data
(
c
,
vector
<
element
::
Int64
::
type
>
{
2
,
3
,
5
,
7
,
11
,
13
});
copy_data
(
c
,
vector
<
element
::
Int64
::
type
>
{
2
,
3
,
5
,
7
,
11
,
13
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
,
c
},
{
result
});
cf
->
call
({
a
,
b
,
c
},
{
result
});
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
2
,
4
,
8
,
16
,
1
,
2
,
4
,
8
,
16
,
32
,
2
,
3
,
5
,
7
,
11
,
13
}),
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
2
,
4
,
8
,
16
,
1
,
2
,
4
,
8
,
16
,
32
,
2
,
3
,
5
,
7
,
11
,
13
}),
result
->
get_vector
<
element
::
Int64
::
type
>
());
result
->
get_vector
<
element
::
Int64
::
type
>
());
}
}
...
@@ -376,7 +376,7 @@ TEST(${BACKEND_NAME}, concat_vector)
...
@@ -376,7 +376,7 @@ TEST(${BACKEND_NAME}, concat_vector)
copy_data
(
c
,
vector
<
float
>
{
18
,
19
});
copy_data
(
c
,
vector
<
float
>
{
18
,
19
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
,
c
},
{
result
});
cf
->
call
({
a
,
b
,
c
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
2
,
4
,
8
,
16
,
1
,
2
,
4
,
8
,
16
,
32
,
18
,
19
}),
ASSERT_EQ
((
vector
<
float
>
{
2
,
4
,
8
,
16
,
1
,
2
,
4
,
8
,
16
,
32
,
18
,
19
}),
result
->
get_vector
<
float
>
());
result
->
get_vector
<
float
>
());
}
}
...
@@ -407,7 +407,7 @@ TEST(${BACKEND_NAME}, divide)
...
@@ -407,7 +407,7 @@ TEST(${BACKEND_NAME}, divide)
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
});
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
2
,
2
,
2
,
2
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
2
,
2
,
2
,
2
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -431,7 +431,7 @@ TEST(${BACKEND_NAME}, equal)
...
@@ -431,7 +431,7 @@ TEST(${BACKEND_NAME}, equal)
copy_data
(
b
,
vector
<
float
>
{
1
,
8
,
4
,
8
,
0
,
0
,
1
,
1.5
});
copy_data
(
b
,
vector
<
float
>
{
1
,
8
,
4
,
8
,
0
,
0
,
1
,
1.5
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
char
>
{
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
}),
result
->
get_vector
<
char
>
());
ASSERT_EQ
((
vector
<
char
>
{
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
}),
result
->
get_vector
<
char
>
());
}
}
...
@@ -456,7 +456,7 @@ TEST(${BACKEND_NAME}, dot_0_0)
...
@@ -456,7 +456,7 @@ TEST(${BACKEND_NAME}, dot_0_0)
copy_data
(
b
,
vector
<
float
>
{});
copy_data
(
b
,
vector
<
float
>
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
0
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
0
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -488,7 +488,7 @@ TEST(${BACKEND_NAME}, dot_matrix_2x0_0x2)
...
@@ -488,7 +488,7 @@ TEST(${BACKEND_NAME}, dot_matrix_2x0_0x2)
copy_data
(
b
,
vector
<
float
>
{});
copy_data
(
b
,
vector
<
float
>
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
0
,
0
,
0
,
0
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
0
,
0
,
0
,
0
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -514,7 +514,7 @@ TEST(${BACKEND_NAME}, dot_matrix_0x2_2x0)
...
@@ -514,7 +514,7 @@ TEST(${BACKEND_NAME}, dot_matrix_0x2_2x0)
copy_data
(
b
,
vector
<
float
>
{});
copy_data
(
b
,
vector
<
float
>
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -540,7 +540,7 @@ TEST(${BACKEND_NAME}, dot_matrix_3x2_2x0)
...
@@ -540,7 +540,7 @@ TEST(${BACKEND_NAME}, dot_matrix_3x2_2x0)
copy_data
(
b
,
vector
<
float
>
{});
copy_data
(
b
,
vector
<
float
>
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -566,7 +566,7 @@ TEST(${BACKEND_NAME}, dot_scalar_0x2)
...
@@ -566,7 +566,7 @@ TEST(${BACKEND_NAME}, dot_scalar_0x2)
copy_data
(
b
,
vector
<
float
>
{});
copy_data
(
b
,
vector
<
float
>
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -592,7 +592,7 @@ TEST(${BACKEND_NAME}, dot_2x0_0)
...
@@ -592,7 +592,7 @@ TEST(${BACKEND_NAME}, dot_2x0_0)
copy_data
(
b
,
vector
<
float
>
{});
copy_data
(
b
,
vector
<
float
>
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
0
,
0
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
0
,
0
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -617,7 +617,7 @@ TEST(${BACKEND_NAME}, dot1d)
...
@@ -617,7 +617,7 @@ TEST(${BACKEND_NAME}, dot1d)
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
});
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
170
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
170
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -642,7 +642,7 @@ TEST(${BACKEND_NAME}, dot2d)
...
@@ -642,7 +642,7 @@ TEST(${BACKEND_NAME}, dot2d)
copy_data
(
b
,
vector
<
float
>
{
5
,
6
,
7
,
8
});
copy_data
(
b
,
vector
<
float
>
{
5
,
6
,
7
,
8
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
19
,
22
,
43
,
50
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
19
,
22
,
43
,
50
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -667,7 +667,7 @@ TEST(${BACKEND_NAME}, dot_scalar_tensor_arg0)
...
@@ -667,7 +667,7 @@ TEST(${BACKEND_NAME}, dot_scalar_tensor_arg0)
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
});
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_b
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_b
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
6
,
12
,
18
,
24
,
30
,
36
,
42
,
48
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
6
,
12
,
18
,
24
,
30
,
36
,
42
,
48
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -692,7 +692,7 @@ TEST(${BACKEND_NAME}, dot_scalar_tensor_arg1)
...
@@ -692,7 +692,7 @@ TEST(${BACKEND_NAME}, dot_scalar_tensor_arg1)
copy_data
(
b
,
vector
<
float
>
{
6
});
copy_data
(
b
,
vector
<
float
>
{
6
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_a
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_a
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
6
,
12
,
18
,
24
,
30
,
36
,
42
,
48
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
6
,
12
,
18
,
24
,
30
,
36
,
42
,
48
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -716,7 +716,7 @@ TEST(${BACKEND_NAME}, dot_scalar_scalar)
...
@@ -716,7 +716,7 @@ TEST(${BACKEND_NAME}, dot_scalar_scalar)
copy_data
(
b
,
vector
<
float
>
{
6
});
copy_data
(
b
,
vector
<
float
>
{
6
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
48
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
48
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -742,7 +742,7 @@ TEST(${BACKEND_NAME}, dot_matrix_vector)
...
@@ -742,7 +742,7 @@ TEST(${BACKEND_NAME}, dot_matrix_vector)
copy_data
(
b
,
vector
<
float
>
{
17
,
18
,
19
,
20
});
copy_data
(
b
,
vector
<
float
>
{
17
,
18
,
19
,
20
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
190
,
486
,
782
,
1078
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
190
,
486
,
782
,
1078
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -769,7 +769,7 @@ TEST(${BACKEND_NAME}, dot_matrix_vector_int64)
...
@@ -769,7 +769,7 @@ TEST(${BACKEND_NAME}, dot_matrix_vector_int64)
copy_data
(
b
,
vector
<
element
::
Int64
::
type
>
{
17
,
18
,
19
,
20
});
copy_data
(
b
,
vector
<
element
::
Int64
::
type
>
{
17
,
18
,
19
,
20
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
190
,
486
,
782
,
1078
}),
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
190
,
486
,
782
,
1078
}),
result
->
get_vector
<
element
::
Int64
::
type
>
());
result
->
get_vector
<
element
::
Int64
::
type
>
());
}
}
...
@@ -794,7 +794,7 @@ TEST(${BACKEND_NAME}, greater)
...
@@ -794,7 +794,7 @@ TEST(${BACKEND_NAME}, greater)
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
,
0
,
0
,
1
,
1.5
});
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
,
0
,
0
,
1
,
1.5
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
char
>
{
0
,
1
,
0
,
1
,
0
,
1
,
1
,
0
}),
result
->
get_vector
<
char
>
());
ASSERT_EQ
((
vector
<
char
>
{
0
,
1
,
0
,
1
,
0
,
1
,
1
,
0
}),
result
->
get_vector
<
char
>
());
}
}
...
@@ -818,7 +818,7 @@ TEST(${BACKEND_NAME}, greatereq)
...
@@ -818,7 +818,7 @@ TEST(${BACKEND_NAME}, greatereq)
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
-
8
,
8
,
0
,
0
,
0.5
,
1.5
});
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
-
8
,
8
,
0
,
0
,
0.5
,
1.5
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
char
>
{
1
,
1
,
1
,
1
,
0
,
1
,
1
,
0
}),
result
->
get_vector
<
char
>
());
ASSERT_EQ
((
vector
<
char
>
{
1
,
1
,
1
,
1
,
0
,
1
,
1
,
0
}),
result
->
get_vector
<
char
>
());
}
}
...
@@ -842,7 +842,7 @@ TEST(${BACKEND_NAME}, less)
...
@@ -842,7 +842,7 @@ TEST(${BACKEND_NAME}, less)
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
,
0
,
0
,
1
,
1.5
});
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
,
0
,
0
,
1
,
1.5
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
char
>
{
0
,
0
,
1
,
0
,
1
,
0
,
0
,
1
}),
result
->
get_vector
<
char
>
());
ASSERT_EQ
((
vector
<
char
>
{
0
,
0
,
1
,
0
,
1
,
0
,
0
,
1
}),
result
->
get_vector
<
char
>
());
}
}
...
@@ -866,7 +866,7 @@ TEST(${BACKEND_NAME}, lesseq)
...
@@ -866,7 +866,7 @@ TEST(${BACKEND_NAME}, lesseq)
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
-
8
,
8
,
0
,
0
,
0.5
,
1.5
});
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
-
8
,
8
,
0
,
0
,
0.5
,
1.5
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
char
>
{
1
,
0
,
1
,
0
,
1
,
1
,
0
,
1
}),
result
->
get_vector
<
char
>
());
ASSERT_EQ
((
vector
<
char
>
{
1
,
0
,
1
,
0
,
1
,
1
,
0
,
1
}),
result
->
get_vector
<
char
>
());
}
}
...
@@ -890,7 +890,7 @@ TEST(${BACKEND_NAME}, lesseq_bool)
...
@@ -890,7 +890,7 @@ TEST(${BACKEND_NAME}, lesseq_bool)
copy_data
(
b
,
vector
<
char
>
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
});
copy_data
(
b
,
vector
<
char
>
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
char
>
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}),
result
->
get_vector
<
char
>
());
ASSERT_EQ
((
vector
<
char
>
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}),
result
->
get_vector
<
char
>
());
}
}
...
@@ -917,7 +917,7 @@ TEST(${BACKEND_NAME}, log)
...
@@ -917,7 +917,7 @@ TEST(${BACKEND_NAME}, log)
}
}
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
loga
,
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
loga
,
result
->
get_vector
<
float
>
());
}
}
...
@@ -941,7 +941,7 @@ TEST(${BACKEND_NAME}, maximum)
...
@@ -941,7 +941,7 @@ TEST(${BACKEND_NAME}, maximum)
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
,
0
,
0
,
1
,
1.5
});
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
,
0
,
0
,
1
,
1.5
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
8
,
4
,
17
,
0
,
0.5
,
2
,
1.5
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
8
,
4
,
17
,
0
,
0.5
,
2
,
1.5
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -965,7 +965,7 @@ TEST(${BACKEND_NAME}, minimum)
...
@@ -965,7 +965,7 @@ TEST(${BACKEND_NAME}, minimum)
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
,
0
,
0
,
1
,
1.5
});
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
,
0
,
0
,
1
,
1.5
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
-
8
,
8
,
-
.5
,
0
,
1
,
1
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
-
8
,
8
,
-
.5
,
0
,
1
,
1
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -986,7 +986,7 @@ TEST(${BACKEND_NAME}, negative)
...
@@ -986,7 +986,7 @@ TEST(${BACKEND_NAME}, negative)
copy_data
(
a
,
vector
<
float
>
{
1
,
-
2
,
0
,
-
4.8
f
,
8.6
f
,
-
8.6
f
});
copy_data
(
a
,
vector
<
float
>
{
1
,
-
2
,
0
,
-
4.8
f
,
8.6
f
,
-
8.6
f
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
-
1
,
2
,
0
,
4.8
f
,
-
8.6
f
,
8.6
f
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
-
1
,
2
,
0
,
4.8
f
,
-
8.6
f
,
8.6
f
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1010,7 +1010,7 @@ TEST(${BACKEND_NAME}, notequal)
...
@@ -1010,7 +1010,7 @@ TEST(${BACKEND_NAME}, notequal)
copy_data
(
b
,
vector
<
float
>
{
1
,
8
,
4
,
8
,
0
,
0
,
1
,
1.5
});
copy_data
(
b
,
vector
<
float
>
{
1
,
8
,
4
,
8
,
0
,
0
,
1
,
1.5
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
char
>
{
0
,
0
,
1
,
1
,
1
,
0
,
0
,
1
}),
result
->
get_vector
<
char
>
());
ASSERT_EQ
((
vector
<
char
>
{
0
,
0
,
1
,
1
,
1
,
0
,
0
,
1
}),
result
->
get_vector
<
char
>
());
}
}
...
@@ -1037,7 +1037,7 @@ TEST(${BACKEND_NAME}, select)
...
@@ -1037,7 +1037,7 @@ TEST(${BACKEND_NAME}, select)
copy_data
(
c
,
vector
<
float
>
{
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
});
copy_data
(
c
,
vector
<
float
>
{
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
,
c
},
{
result
});
cf
->
call
({
a
,
b
,
c
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
11
,
2
,
3
,
14
,
15
,
6
,
17
,
8
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
11
,
2
,
3
,
14
,
15
,
6
,
17
,
8
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1061,7 +1061,7 @@ TEST(${BACKEND_NAME}, subtract)
...
@@ -1061,7 +1061,7 @@ TEST(${BACKEND_NAME}, subtract)
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
});
copy_data
(
b
,
vector
<
float
>
{
1
,
2
,
4
,
8
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
4
,
8
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
4
,
8
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1081,7 +1081,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_bool)
...
@@ -1081,7 +1081,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_bool)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
char
>
{
true
}),
result
->
get_vector
<
char
>
());
ASSERT_EQ
((
vector
<
char
>
{
true
}),
result
->
get_vector
<
char
>
());
}
}
...
@@ -1101,7 +1101,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_float)
...
@@ -1101,7 +1101,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_float)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
-
3.0
f
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
-
3.0
f
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1121,7 +1121,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_int8)
...
@@ -1121,7 +1121,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_int8)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int8
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int8
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
int8_t
>
{
-
3
}),
result
->
get_vector
<
int8_t
>
());
ASSERT_EQ
((
vector
<
int8_t
>
{
-
3
}),
result
->
get_vector
<
int8_t
>
());
}
}
...
@@ -1141,7 +1141,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_int32)
...
@@ -1141,7 +1141,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_int32)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int32
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
int32_t
>
{
-
3
}),
result
->
get_vector
<
int32_t
>
());
ASSERT_EQ
((
vector
<
int32_t
>
{
-
3
}),
result
->
get_vector
<
int32_t
>
());
}
}
...
@@ -1161,7 +1161,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_int64)
...
@@ -1161,7 +1161,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_int64)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
int64_t
>
{
-
3
}),
result
->
get_vector
<
int64_t
>
());
ASSERT_EQ
((
vector
<
int64_t
>
{
-
3
}),
result
->
get_vector
<
int64_t
>
());
}
}
...
@@ -1181,7 +1181,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_uint8)
...
@@ -1181,7 +1181,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_uint8)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
UInt8
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
UInt8
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
uint8_t
>
{
3
}),
result
->
get_vector
<
uint8_t
>
());
ASSERT_EQ
((
vector
<
uint8_t
>
{
3
}),
result
->
get_vector
<
uint8_t
>
());
}
}
...
@@ -1201,7 +1201,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_uint32)
...
@@ -1201,7 +1201,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_uint32)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
UInt32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
UInt32
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
uint32_t
>
{
3
}),
result
->
get_vector
<
uint32_t
>
());
ASSERT_EQ
((
vector
<
uint32_t
>
{
3
}),
result
->
get_vector
<
uint32_t
>
());
}
}
...
@@ -1221,7 +1221,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_uint64)
...
@@ -1221,7 +1221,7 @@ TEST(${BACKEND_NAME}, scalar_parameterized_constant_uint64)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
UInt64
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
UInt64
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
uint64_t
>
{
3
}),
result
->
get_vector
<
uint64_t
>
());
ASSERT_EQ
((
vector
<
uint64_t
>
{
3
}),
result
->
get_vector
<
uint64_t
>
());
}
}
...
@@ -1241,7 +1241,7 @@ TEST(${BACKEND_NAME}, tensor_constant)
...
@@ -1241,7 +1241,7 @@ TEST(${BACKEND_NAME}, tensor_constant)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1261,7 +1261,7 @@ TEST(${BACKEND_NAME}, tensor_constant_with_op)
...
@@ -1261,7 +1261,7 @@ TEST(${BACKEND_NAME}, tensor_constant_with_op)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1299,13 +1299,13 @@ TEST(${BACKEND_NAME}, function_call)
...
@@ -1299,13 +1299,13 @@ TEST(${BACKEND_NAME}, function_call)
copy_data
(
z
,
vector
<
float
>
{
9
,
10
,
11
,
12
});
copy_data
(
z
,
vector
<
float
>
{
9
,
10
,
11
,
12
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
x
,
y
,
z
},
{
result
});
cf
->
call
({
x
,
y
,
z
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
108
,
160
,
220
,
288
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
108
,
160
,
220
,
288
}),
result
->
get_vector
<
float
>
());
(
*
cf
)
({
y
,
x
,
z
},
{
result
});
cf
->
call
({
y
,
x
,
z
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
108
,
160
,
220
,
288
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
108
,
160
,
220
,
288
}),
result
->
get_vector
<
float
>
());
(
*
cf
)
({
x
,
z
,
y
},
{
result
});
cf
->
call
({
x
,
z
,
y
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
100
,
144
,
196
,
256
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
100
,
144
,
196
,
256
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1328,7 +1328,7 @@ TEST(${BACKEND_NAME}, broadcast_scalar_vector)
...
@@ -1328,7 +1328,7 @@ TEST(${BACKEND_NAME}, broadcast_scalar_vector)
copy_data
(
a
,
vector
<
float
>
{
6
});
copy_data
(
a
,
vector
<
float
>
{
6
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
6
,
6
,
6
,
6
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
6
,
6
,
6
,
6
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1351,7 +1351,7 @@ TEST(${BACKEND_NAME}, broadcast_scalar_matrix)
...
@@ -1351,7 +1351,7 @@ TEST(${BACKEND_NAME}, broadcast_scalar_matrix)
copy_data
(
a
,
vector
<
float
>
{
6
});
copy_data
(
a
,
vector
<
float
>
{
6
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
6
,
6
,
6
,
6
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
6
,
6
,
6
,
6
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1374,7 +1374,7 @@ TEST(${BACKEND_NAME}, broadcast_scalar_tensor)
...
@@ -1374,7 +1374,7 @@ TEST(${BACKEND_NAME}, broadcast_scalar_tensor)
copy_data
(
a
,
vector
<
float
>
{
6
});
copy_data
(
a
,
vector
<
float
>
{
6
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1396,7 +1396,7 @@ TEST(${BACKEND_NAME}, broadcast_trivial)
...
@@ -1396,7 +1396,7 @@ TEST(${BACKEND_NAME}, broadcast_trivial)
copy_data
(
a
,
vector
<
float
>
{
2
,
4
,
6
,
8
,
16
,
32
,
64
,
128
});
copy_data
(
a
,
vector
<
float
>
{
2
,
4
,
6
,
8
,
16
,
32
,
64
,
128
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
2
,
4
,
6
,
8
,
16
,
32
,
64
,
128
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
2
,
4
,
6
,
8
,
16
,
32
,
64
,
128
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1419,7 +1419,7 @@ TEST(${BACKEND_NAME}, broadcast_vector_colwise)
...
@@ -1419,7 +1419,7 @@ TEST(${BACKEND_NAME}, broadcast_vector_colwise)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
1
,
1
,
1
,
2
,
2
,
2
,
2
,
3
,
3
,
3
,
3
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
1
,
1
,
1
,
2
,
2
,
2
,
2
,
3
,
3
,
3
,
3
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1442,7 +1442,7 @@ TEST(${BACKEND_NAME}, broadcast_vector_rowwise)
...
@@ -1442,7 +1442,7 @@ TEST(${BACKEND_NAME}, broadcast_vector_rowwise)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
,
1
,
2
,
3
,
4
,
1
,
2
,
3
,
4
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
,
1
,
2
,
3
,
4
,
1
,
2
,
3
,
4
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1465,7 +1465,7 @@ TEST(${BACKEND_NAME}, broadcast_vector_rowwise_int64)
...
@@ -1465,7 +1465,7 @@ TEST(${BACKEND_NAME}, broadcast_vector_rowwise_int64)
copy_data
(
a
,
vector
<
element
::
Int64
::
type
>
{
1
,
2
,
3
,
4
});
copy_data
(
a
,
vector
<
element
::
Int64
::
type
>
{
1
,
2
,
3
,
4
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
1
,
2
,
3
,
4
,
1
,
2
,
3
,
4
,
1
,
2
,
3
,
4
}),
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
1
,
2
,
3
,
4
,
1
,
2
,
3
,
4
,
1
,
2
,
3
,
4
}),
result
->
get_vector
<
element
::
Int64
::
type
>
());
result
->
get_vector
<
element
::
Int64
::
type
>
());
}
}
...
@@ -1488,7 +1488,7 @@ TEST(${BACKEND_NAME}, convert_int32_float32)
...
@@ -1488,7 +1488,7 @@ TEST(${BACKEND_NAME}, convert_int32_float32)
copy_data
(
a
,
vector
<
element
::
Int32
::
type
>
{
1
,
2
,
3
,
4
});
copy_data
(
a
,
vector
<
element
::
Int32
::
type
>
{
1
,
2
,
3
,
4
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
element
::
Float32
::
type
>
{
1
,
2
,
3
,
4
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
element
::
Float32
::
type
>
{
1
,
2
,
3
,
4
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1510,7 +1510,7 @@ TEST(${BACKEND_NAME}, convert_int32_bool)
...
@@ -1510,7 +1510,7 @@ TEST(${BACKEND_NAME}, convert_int32_bool)
copy_data
(
a
,
vector
<
element
::
Int32
::
type
>
{
1
,
2
,
3
,
4
});
copy_data
(
a
,
vector
<
element
::
Int32
::
type
>
{
1
,
2
,
3
,
4
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
element
::
Bool
::
type
>
{
1
,
2
,
3
,
4
}),
result
->
get_vector
<
element
::
Bool
::
type
>
());
ASSERT_EQ
((
vector
<
element
::
Bool
::
type
>
{
1
,
2
,
3
,
4
}),
result
->
get_vector
<
element
::
Bool
::
type
>
());
}
}
...
@@ -1532,7 +1532,7 @@ TEST(${BACKEND_NAME}, convert_float32_bool)
...
@@ -1532,7 +1532,7 @@ TEST(${BACKEND_NAME}, convert_float32_bool)
copy_data
(
a
,
vector
<
element
::
Float32
::
type
>
{
1
,
2
,
3
,
4
});
copy_data
(
a
,
vector
<
element
::
Float32
::
type
>
{
1
,
2
,
3
,
4
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
element
::
Bool
::
type
>
{
1
,
2
,
3
,
4
}),
result
->
get_vector
<
element
::
Bool
::
type
>
());
ASSERT_EQ
((
vector
<
element
::
Bool
::
type
>
{
1
,
2
,
3
,
4
}),
result
->
get_vector
<
element
::
Bool
::
type
>
());
}
}
...
@@ -1565,7 +1565,7 @@ TEST(${BACKEND_NAME}, reduce_trivial)
...
@@ -1565,7 +1565,7 @@ TEST(${BACKEND_NAME}, reduce_trivial)
copy_data
(
b
,
vector
<
float
>
{
0
,
0
,
0
,
0
});
copy_data
(
b
,
vector
<
float
>
{
0
,
0
,
0
,
0
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1597,7 +1597,7 @@ TEST(${BACKEND_NAME}, reduce_to_scalar)
...
@@ -1597,7 +1597,7 @@ TEST(${BACKEND_NAME}, reduce_to_scalar)
copy_data
(
b
,
vector
<
float
>
{
0
});
copy_data
(
b
,
vector
<
float
>
{
0
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
Shape
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
Shape
{});
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
10
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
10
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -1635,7 +1635,7 @@ TEST(${BACKEND_NAME}, reduce_matrix_columns)
...
@@ -1635,7 +1635,7 @@ TEST(${BACKEND_NAME}, reduce_matrix_columns)
copy_data
(
b
,
vector
<
float
>
{
0
});
copy_data
(
b
,
vector
<
float
>
{
0
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
9
,
12
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
9
,
12
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -1673,7 +1673,7 @@ TEST(${BACKEND_NAME}, reduce_matrix_rows)
...
@@ -1673,7 +1673,7 @@ TEST(${BACKEND_NAME}, reduce_matrix_rows)
copy_data
(
b
,
vector
<
float
>
{
0
});
copy_data
(
b
,
vector
<
float
>
{
0
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
3
,
7
,
11
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
3
,
7
,
11
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -1711,7 +1711,7 @@ TEST(${BACKEND_NAME}, reduce_matrix_rows_zero)
...
@@ -1711,7 +1711,7 @@ TEST(${BACKEND_NAME}, reduce_matrix_rows_zero)
copy_data
(
b
,
vector
<
float
>
{
66
});
copy_data
(
b
,
vector
<
float
>
{
66
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
66
,
66
,
66
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
66
,
66
,
66
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -1749,7 +1749,7 @@ TEST(${BACKEND_NAME}, reduce_matrix_cols_zero)
...
@@ -1749,7 +1749,7 @@ TEST(${BACKEND_NAME}, reduce_matrix_cols_zero)
copy_data
(
b
,
vector
<
float
>
{
77
});
copy_data
(
b
,
vector
<
float
>
{
77
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
77
,
77
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
77
,
77
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -1787,7 +1787,7 @@ TEST(${BACKEND_NAME}, reduce_vector_zero)
...
@@ -1787,7 +1787,7 @@ TEST(${BACKEND_NAME}, reduce_vector_zero)
copy_data
(
b
,
vector
<
float
>
{
88
});
copy_data
(
b
,
vector
<
float
>
{
88
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
88
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
88
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -1825,7 +1825,7 @@ TEST(${BACKEND_NAME}, reduce_matrix_to_scalar_zero_by_zero)
...
@@ -1825,7 +1825,7 @@ TEST(${BACKEND_NAME}, reduce_matrix_to_scalar_zero_by_zero)
copy_data
(
b
,
vector
<
float
>
{
99
});
copy_data
(
b
,
vector
<
float
>
{
99
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
99
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
99
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -1854,7 +1854,7 @@ TEST(${BACKEND_NAME}, reshape_t2v_012)
...
@@ -1854,7 +1854,7 @@ TEST(${BACKEND_NAME}, reshape_t2v_012)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1878,7 +1878,7 @@ TEST(${BACKEND_NAME}, reshape_t2s_012)
...
@@ -1878,7 +1878,7 @@ TEST(${BACKEND_NAME}, reshape_t2s_012)
copy_data
(
a
,
vector
<
float
>
{
6
});
copy_data
(
a
,
vector
<
float
>
{
6
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
6
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
6
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1902,7 +1902,7 @@ TEST(${BACKEND_NAME}, reshape_t2s_120)
...
@@ -1902,7 +1902,7 @@ TEST(${BACKEND_NAME}, reshape_t2s_120)
copy_data
(
a
,
vector
<
float
>
{
6
});
copy_data
(
a
,
vector
<
float
>
{
6
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
6
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
6
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1926,7 +1926,7 @@ TEST(${BACKEND_NAME}, reshape_s2t)
...
@@ -1926,7 +1926,7 @@ TEST(${BACKEND_NAME}, reshape_s2t)
copy_data
(
a
,
vector
<
float
>
{
42
});
copy_data
(
a
,
vector
<
float
>
{
42
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
42
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
42
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1950,7 +1950,7 @@ TEST(${BACKEND_NAME}, reshape_v2m_col)
...
@@ -1950,7 +1950,7 @@ TEST(${BACKEND_NAME}, reshape_v2m_col)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1974,7 +1974,7 @@ TEST(${BACKEND_NAME}, reshape_v2m_row)
...
@@ -1974,7 +1974,7 @@ TEST(${BACKEND_NAME}, reshape_v2m_row)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -1998,7 +1998,7 @@ TEST(${BACKEND_NAME}, reshape_v2t_middle)
...
@@ -1998,7 +1998,7 @@ TEST(${BACKEND_NAME}, reshape_v2t_middle)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -2022,7 +2022,7 @@ TEST(${BACKEND_NAME}, reshape_m2m_same)
...
@@ -2022,7 +2022,7 @@ TEST(${BACKEND_NAME}, reshape_m2m_same)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -2046,7 +2046,7 @@ TEST(${BACKEND_NAME}, reshape_m2m_transpose)
...
@@ -2046,7 +2046,7 @@ TEST(${BACKEND_NAME}, reshape_m2m_transpose)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
4
,
7
,
2
,
5
,
8
,
3
,
6
,
9
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
4
,
7
,
2
,
5
,
8
,
3
,
6
,
9
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -2070,7 +2070,7 @@ TEST(${BACKEND_NAME}, reshape_m2m_dim_change_transpose)
...
@@ -2070,7 +2070,7 @@ TEST(${BACKEND_NAME}, reshape_m2m_dim_change_transpose)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
3
,
5
,
2
,
4
,
6
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
3
,
5
,
2
,
4
,
6
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -2096,7 +2096,7 @@ TEST(${BACKEND_NAME}, sin)
...
@@ -2096,7 +2096,7 @@ TEST(${BACKEND_NAME}, sin)
std
::
transform
(
std
::
transform
(
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
sinf
(
x
);
});
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
sinf
(
x
);
});
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
}
}
...
@@ -2122,7 +2122,7 @@ TEST(${BACKEND_NAME}, cos)
...
@@ -2122,7 +2122,7 @@ TEST(${BACKEND_NAME}, cos)
std
::
transform
(
std
::
transform
(
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
cosf
(
x
);
});
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
cosf
(
x
);
});
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
}
}
...
@@ -2148,7 +2148,7 @@ TEST(${BACKEND_NAME}, tan)
...
@@ -2148,7 +2148,7 @@ TEST(${BACKEND_NAME}, tan)
std
::
transform
(
std
::
transform
(
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
tanf
(
x
);
});
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
tanf
(
x
);
});
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
}
}
...
@@ -2173,7 +2173,7 @@ TEST(${BACKEND_NAME}, asin)
...
@@ -2173,7 +2173,7 @@ TEST(${BACKEND_NAME}, asin)
std
::
transform
(
std
::
transform
(
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
asinf
(
x
);
});
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
asinf
(
x
);
});
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
}
}
...
@@ -2198,7 +2198,7 @@ TEST(${BACKEND_NAME}, acos)
...
@@ -2198,7 +2198,7 @@ TEST(${BACKEND_NAME}, acos)
std
::
transform
(
std
::
transform
(
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
acosf
(
x
);
});
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
acosf
(
x
);
});
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
}
}
...
@@ -2223,7 +2223,7 @@ TEST(${BACKEND_NAME}, atan)
...
@@ -2223,7 +2223,7 @@ TEST(${BACKEND_NAME}, atan)
std
::
transform
(
std
::
transform
(
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
atanf
(
x
);
});
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
atanf
(
x
);
});
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
}
}
...
@@ -2248,7 +2248,7 @@ TEST(${BACKEND_NAME}, sinh)
...
@@ -2248,7 +2248,7 @@ TEST(${BACKEND_NAME}, sinh)
std
::
transform
(
std
::
transform
(
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
sinhf
(
x
);
});
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
sinhf
(
x
);
});
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
}
}
...
@@ -2273,7 +2273,7 @@ TEST(${BACKEND_NAME}, cosh)
...
@@ -2273,7 +2273,7 @@ TEST(${BACKEND_NAME}, cosh)
std
::
transform
(
std
::
transform
(
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
coshf
(
x
);
});
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
coshf
(
x
);
});
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
}
}
...
@@ -2298,7 +2298,7 @@ TEST(${BACKEND_NAME}, tanh)
...
@@ -2298,7 +2298,7 @@ TEST(${BACKEND_NAME}, tanh)
std
::
transform
(
std
::
transform
(
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
tanhf
(
x
);
});
input
.
begin
(),
input
.
end
(),
input
.
begin
(),
[](
float
x
)
->
float
{
return
tanhf
(
x
);
});
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
input
,
result
->
get_vector
<
float
>
());
}
}
...
@@ -2319,7 +2319,7 @@ TEST(${BACKEND_NAME}, exp)
...
@@ -2319,7 +2319,7 @@ TEST(${BACKEND_NAME}, exp)
copy_data
(
a
,
vector
<
float
>
{
-
4
,
-
3
,
-
2
,
-
1
,
0
,
1
,
2
,
3
});
copy_data
(
a
,
vector
<
float
>
{
-
4
,
-
3
,
-
2
,
-
1
,
0
,
1
,
2
,
3
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
(
ASSERT_EQ
(
(
vector
<
float
>
{
expf
(
-
4
),
expf
(
-
3
),
expf
(
-
2
),
expf
(
-
1
),
expf
(
0
),
expf
(
1
),
expf
(
2
),
expf
(
3
)}),
(
vector
<
float
>
{
expf
(
-
4
),
expf
(
-
3
),
expf
(
-
2
),
expf
(
-
1
),
expf
(
0
),
expf
(
1
),
expf
(
2
),
expf
(
3
)}),
result
->
get_vector
<
float
>
());
result
->
get_vector
<
float
>
());
...
@@ -2345,7 +2345,7 @@ TEST(${BACKEND_NAME}, slice_scalar)
...
@@ -2345,7 +2345,7 @@ TEST(${BACKEND_NAME}, slice_scalar)
copy_data
(
a
,
vector
<
float
>
{
312
});
copy_data
(
a
,
vector
<
float
>
{
312
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
312
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
312
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -2369,7 +2369,7 @@ TEST(${BACKEND_NAME}, slice_matrix)
...
@@ -2369,7 +2369,7 @@ TEST(${BACKEND_NAME}, slice_matrix)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
2
,
3
,
6
,
7
,
10
,
11
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
2
,
3
,
6
,
7
,
10
,
11
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -2393,7 +2393,7 @@ TEST(${BACKEND_NAME}, slice_vector)
...
@@ -2393,7 +2393,7 @@ TEST(${BACKEND_NAME}, slice_vector)
copy_data
(
a
,
vector
<
float
>
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
});
copy_data
(
a
,
vector
<
float
>
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_r
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -2411,7 +2411,7 @@ TEST(${BACKEND_NAME}, scalar_constant_float32)
...
@@ -2411,7 +2411,7 @@ TEST(${BACKEND_NAME}, scalar_constant_float32)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
Shape
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
Shape
{});
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
(
vector
<
float
>
{
std
::
strtof
(
"4.8"
,
NULL
)},
result
->
get_vector
<
float
>
());
ASSERT_EQ
(
vector
<
float
>
{
std
::
strtof
(
"4.8"
,
NULL
)},
result
->
get_vector
<
float
>
());
}
}
...
@@ -2429,7 +2429,7 @@ TEST(${BACKEND_NAME}, scalar_constant_int64)
...
@@ -2429,7 +2429,7 @@ TEST(${BACKEND_NAME}, scalar_constant_int64)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
Shape
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
Shape
{});
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
(
vector
<
element
::
Int64
::
type
>
{
std
::
strtol
(
"2112"
,
NULL
,
10
)},
ASSERT_EQ
(
vector
<
element
::
Int64
::
type
>
{
std
::
strtol
(
"2112"
,
NULL
,
10
)},
result
->
get_vector
<
element
::
Int64
::
type
>
());
result
->
get_vector
<
element
::
Int64
::
type
>
());
}
}
...
@@ -2451,7 +2451,7 @@ TEST(${BACKEND_NAME}, tensor_constant_float32)
...
@@ -2451,7 +2451,7 @@ TEST(${BACKEND_NAME}, tensor_constant_float32)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
std
::
strtof
(
"4.8"
,
NULL
),
ASSERT_EQ
((
vector
<
float
>
{
std
::
strtof
(
"4.8"
,
NULL
),
std
::
strtof
(
"4.7"
,
NULL
),
std
::
strtof
(
"4.7"
,
NULL
),
std
::
strtof
(
"-5.3"
,
NULL
),
std
::
strtof
(
"-5.3"
,
NULL
),
...
@@ -2476,7 +2476,7 @@ TEST(${BACKEND_NAME}, tensor_constant_int64)
...
@@ -2476,7 +2476,7 @@ TEST(${BACKEND_NAME}, tensor_constant_int64)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Int64
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
std
::
strtol
(
"2112"
,
NULL
,
10
),
ASSERT_EQ
((
vector
<
element
::
Int64
::
type
>
{
std
::
strtol
(
"2112"
,
NULL
,
10
),
std
::
strtol
(
"1848"
,
NULL
,
10
),
std
::
strtol
(
"1848"
,
NULL
,
10
),
std
::
strtol
(
"1776"
,
NULL
,
10
),
std
::
strtol
(
"1776"
,
NULL
,
10
),
...
@@ -2502,7 +2502,7 @@ TEST(${BACKEND_NAME}, sum_trivial)
...
@@ -2502,7 +2502,7 @@ TEST(${BACKEND_NAME}, sum_trivial)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
2
,
3
,
4
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -2523,7 +2523,7 @@ TEST(${BACKEND_NAME}, sum_to_scalar)
...
@@ -2523,7 +2523,7 @@ TEST(${BACKEND_NAME}, sum_to_scalar)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
Shape
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
Shape
{});
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
10
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
10
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -2549,7 +2549,7 @@ TEST(${BACKEND_NAME}, sum_matrix_columns)
...
@@ -2549,7 +2549,7 @@ TEST(${BACKEND_NAME}, sum_matrix_columns)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
9
,
12
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
9
,
12
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -2575,7 +2575,7 @@ TEST(${BACKEND_NAME}, sum_matrix_rows)
...
@@ -2575,7 +2575,7 @@ TEST(${BACKEND_NAME}, sum_matrix_rows)
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
});
copy_data
(
a
,
vector
<
float
>
{
1
,
2
,
3
,
4
,
5
,
6
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
3
,
7
,
11
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
3
,
7
,
11
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -2601,7 +2601,7 @@ TEST(${BACKEND_NAME}, sum_matrix_rows_zero)
...
@@ -2601,7 +2601,7 @@ TEST(${BACKEND_NAME}, sum_matrix_rows_zero)
copy_data
(
a
,
vector
<
float
>
{});
copy_data
(
a
,
vector
<
float
>
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
0
,
0
,
0
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
0
,
0
,
0
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -2628,7 +2628,7 @@ TEST(${BACKEND_NAME}, sum_matrix_cols_zero)
...
@@ -2628,7 +2628,7 @@ TEST(${BACKEND_NAME}, sum_matrix_cols_zero)
copy_data
(
a
,
vector
<
float
>
{});
copy_data
(
a
,
vector
<
float
>
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
0
,
0
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
0
,
0
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -2654,7 +2654,7 @@ TEST(${BACKEND_NAME}, sum_vector_zero)
...
@@ -2654,7 +2654,7 @@ TEST(${BACKEND_NAME}, sum_vector_zero)
copy_data
(
a
,
vector
<
float
>
{});
copy_data
(
a
,
vector
<
float
>
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
0
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
0
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -2680,7 +2680,7 @@ TEST(${BACKEND_NAME}, sum_matrix_to_scalar_zero_by_zero)
...
@@ -2680,7 +2680,7 @@ TEST(${BACKEND_NAME}, sum_matrix_to_scalar_zero_by_zero)
copy_data
(
a
,
vector
<
float
>
{});
copy_data
(
a
,
vector
<
float
>
{});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape_rt
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
0
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
0
}),
result
->
get_vector
<
float
>
());
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
// For some reason I'm feeling extra paranoid about making sure reduction doesn't clobber the
...
@@ -2705,7 +2705,7 @@ TEST(${BACKEND_NAME}, sign)
...
@@ -2705,7 +2705,7 @@ TEST(${BACKEND_NAME}, sign)
copy_data
(
a
,
vector
<
float
>
{
1
,
-
2
,
0
,
-
4.8
f
,
4.8
f
,
-
0.0
});
copy_data
(
a
,
vector
<
float
>
{
1
,
-
2
,
0
,
-
4.8
f
,
4.8
f
,
-
0.0
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
},
{
result
});
cf
->
call
({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
-
1
,
0
,
-
1
,
1
,
0
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
-
1
,
0
,
-
1
,
1
,
0
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -2729,7 +2729,7 @@ TEST(${BACKEND_NAME}, power)
...
@@ -2729,7 +2729,7 @@ TEST(${BACKEND_NAME}, power)
copy_data
(
b
,
vector
<
float
>
{
2
,
0
,
6
,
3
});
copy_data
(
b
,
vector
<
float
>
{
2
,
0
,
6
,
3
});
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Float32
::
element_type
(),
shape
);
(
*
cf
)
({
a
,
b
},
{
result
});
cf
->
call
({
a
,
b
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
1
,
729
,
125
}),
result
->
get_vector
<
float
>
());
ASSERT_EQ
((
vector
<
float
>
{
1
,
1
,
729
,
125
}),
result
->
get_vector
<
float
>
());
}
}
...
@@ -2756,6 +2756,6 @@ TEST(${BACKEND_NAME}, constant_equality_bool)
...
@@ -2756,6 +2756,6 @@ TEST(${BACKEND_NAME}, constant_equality_bool)
// Create some tensors for input/output
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)
({},
{
result
});
cf
->
call
({},
{
result
});
ASSERT_EQ
((
vector
<
char
>
{
true
,
false
,
true
,
false
}),
result
->
get_vector
<
char
>
());
ASSERT_EQ
((
vector
<
char
>
{
true
,
false
,
true
,
false
}),
result
->
get_vector
<
char
>
());
}
}
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