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
d43a0557
Unverified
Commit
d43a0557
authored
Jan 18, 2018
by
Matthew Brookhart
Committed by
GitHub
Jan 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zero-sized tensor tests with multiple data types (#378)
parent
ab3e3965
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
203 additions
and
0 deletions
+203
-0
backend_test.in.cpp
test/backend_test.in.cpp
+203
-0
No files found.
test/backend_test.in.cpp
View file @
d43a0557
...
...
@@ -5378,3 +5378,205 @@ TEST(${BACKEND_NAME}, select_and_scatter_3d_without_overlap)
.
get_vector
()),
result
->
get_vector
<
float
>
());
}
template
<
typename
T
,
typename
ET
>
void
make_unary_empty_test
()
{
auto
shape
=
Shape
{
0
};
auto
A
=
make_shared
<
op
::
Parameter
>
(
element
::
from
<
ET
>
(),
shape
);
auto
f
=
make_shared
<
Function
>
(
make_shared
<
T
>
(
A
),
op
::
Parameters
{
A
});
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
external
=
manager
->
compile
(
f
);
auto
backend
=
manager
->
allocate_backend
();
auto
cf
=
backend
->
make_call_frame
(
external
);
auto
a
=
backend
->
make_primary_tensor_view
(
element
::
from
<
ET
>
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
from
<
ET
>
(),
shape
);
cf
->
call
({
a
},
{
result
});
auto
in_vec
=
a
->
template
get_vector
<
ET
>
();
auto
out_vec
=
result
->
template
get_vector
<
ET
>
();
EXPECT_EQ
(
in_vec
,
out_vec
);
}
template
<
typename
T
,
typename
ET
>
void
make_binary_empty_test
()
{
auto
shape
=
Shape
{
0
};
auto
A
=
make_shared
<
op
::
Parameter
>
(
element
::
from
<
ET
>
(),
shape
);
auto
B
=
make_shared
<
op
::
Parameter
>
(
element
::
from
<
ET
>
(),
shape
);
auto
f
=
make_shared
<
Function
>
(
make_shared
<
T
>
(
A
,
B
),
op
::
Parameters
{
A
,
B
});
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
external
=
manager
->
compile
(
f
);
auto
backend
=
manager
->
allocate_backend
();
auto
cf
=
backend
->
make_call_frame
(
external
);
auto
a
=
backend
->
make_primary_tensor_view
(
element
::
from
<
ET
>
(),
shape
);
auto
b
=
backend
->
make_primary_tensor_view
(
element
::
from
<
ET
>
(),
shape
);
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
from
<
ET
>
(),
shape
);
cf
->
call
({
a
,
b
},
{
result
});
auto
in_vec
=
a
->
template
get_vector
<
ET
>
();
auto
out_vec
=
result
->
template
get_vector
<
ET
>
();
EXPECT_EQ
(
in_vec
,
out_vec
);
}
template
<
typename
T
>
void
make_binary_empty_test
()
{
make_binary_empty_test
<
T
,
float
>
();
make_binary_empty_test
<
T
,
double
>
();
make_binary_empty_test
<
T
,
int8_t
>
();
make_binary_empty_test
<
T
,
int16_t
>
();
make_binary_empty_test
<
T
,
int32_t
>
();
make_binary_empty_test
<
T
,
int64_t
>
();
make_binary_empty_test
<
T
,
uint8_t
>
();
make_binary_empty_test
<
T
,
uint16_t
>
();
make_binary_empty_test
<
T
,
uint32_t
>
();
make_binary_empty_test
<
T
,
uint64_t
>
();
}
template
<
typename
T
>
void
make_unary_empty_test
()
{
make_unary_empty_test
<
T
,
float
>
();
make_unary_empty_test
<
T
,
double
>
();
make_unary_empty_test
<
T
,
int8_t
>
();
make_unary_empty_test
<
T
,
int16_t
>
();
make_unary_empty_test
<
T
,
int32_t
>
();
make_unary_empty_test
<
T
,
int64_t
>
();
make_unary_empty_test
<
T
,
uint8_t
>
();
make_unary_empty_test
<
T
,
uint16_t
>
();
make_unary_empty_test
<
T
,
uint32_t
>
();
make_unary_empty_test
<
T
,
uint64_t
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_abs
)
{
make_unary_empty_test
<
op
::
Abs
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_ceiling
)
{
make_unary_empty_test
<
op
::
Ceiling
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_exp
)
{
make_unary_empty_test
<
op
::
Exp
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_floor
)
{
make_unary_empty_test
<
op
::
Floor
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_log
)
{
make_unary_empty_test
<
op
::
Log
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_negative
)
{
make_unary_empty_test
<
op
::
Negative
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_not
)
{
make_unary_empty_test
<
op
::
Not
,
char
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_sign
)
{
make_unary_empty_test
<
op
::
Sign
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_sqrt
)
{
make_unary_empty_test
<
op
::
Sqrt
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_sin
)
{
make_unary_empty_test
<
op
::
Sin
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_sinh
)
{
make_unary_empty_test
<
op
::
Sinh
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_cos
)
{
make_unary_empty_test
<
op
::
Cos
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_cosh
)
{
make_unary_empty_test
<
op
::
Cosh
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_tan
)
{
make_unary_empty_test
<
op
::
Tan
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_tanh
)
{
make_unary_empty_test
<
op
::
Tanh
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_asin
)
{
make_unary_empty_test
<
op
::
Asin
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_acos
)
{
make_unary_empty_test
<
op
::
Acos
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_atan
)
{
make_unary_empty_test
<
op
::
Atan
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_add
)
{
make_binary_empty_test
<
op
::
Add
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_divide
)
{
make_binary_empty_test
<
op
::
Divide
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_eq
)
{
make_binary_empty_test
<
op
::
Equal
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_greater
)
{
make_binary_empty_test
<
op
::
Greater
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_greatereq
)
{
make_binary_empty_test
<
op
::
GreaterEq
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_less
)
{
make_binary_empty_test
<
op
::
Less
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_lesseq
)
{
make_binary_empty_test
<
op
::
LessEq
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_maximum
)
{
make_binary_empty_test
<
op
::
Maximum
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_minimum
)
{
make_binary_empty_test
<
op
::
Minimum
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_multiply
)
{
make_binary_empty_test
<
op
::
Multiply
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_not_equal
)
{
make_binary_empty_test
<
op
::
NotEqual
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_power
)
{
make_binary_empty_test
<
op
::
Power
>
();
}
TEST
(
$
{
BACKEND_NAME
},
zero_sized_subtract
)
{
make_binary_empty_test
<
op
::
Subtract
>
();
}
\ No newline at end of file
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