"model/sentencepiece.go" did not exist on "b51e0f397ced70bbfa7f22e9b3c94953967cb8e5"
Commit cce2d317 authored by Khalique's avatar Khalique
Browse files

Merge branch 'develop' of https://github.com/ROCmSoftwarePlatform/AMDMIGraphX into gemm_beta

parents 99432ec3 46b3e7da
 elu-example:L

01"Elu*
alpha
#<
test-modelZ
0

b
1

B
\ No newline at end of file
flatten-example:„

02"Flatten*
axis 

03"Flatten test-flattenZ
0




b
2


b
3


<B
\ No newline at end of file
implicit_bcast-example:q

0
12"Addtest-multi_bcastZ
0




Z
1


b
2




B
\ No newline at end of file
......@@ -7,7 +7,7 @@
#include <migraphx/onnx.hpp>
#include "test.hpp"
void pytorch_conv_bias_test()
TEST_CASE(pytorch_conv_bias_test)
{
migraphx::program p;
auto l0 = p.add_parameter("0", {migraphx::shape::float_type, {1, 3, 32, 32}});
......@@ -22,7 +22,7 @@ void pytorch_conv_bias_test()
EXPECT(p == prog);
}
void pytorch_conv_relu_maxpool()
TEST_CASE(pytorch_conv_relu_maxpool)
{
migraphx::program p;
auto l0 = p.add_parameter("0", {migraphx::shape::float_type, {1, 3, 32, 32}});
......@@ -39,7 +39,7 @@ void pytorch_conv_relu_maxpool()
EXPECT(p == prog);
}
void pytorch_conv_bn_relu_maxpool()
TEST_CASE(pytorch_conv_bn_relu_maxpool)
{
migraphx::program p;
auto l0 = p.add_parameter("0", {migraphx::shape::float_type, {1, 3, 32, 32}});
......@@ -62,7 +62,7 @@ void pytorch_conv_bn_relu_maxpool()
EXPECT(p == prog);
}
void pytorch_conv_relu_maxpool_x2()
TEST_CASE(pytorch_conv_relu_maxpool_x2)
{
migraphx::program p;
auto l0 = p.add_parameter("0", {migraphx::shape::float_type, {1, 3, 32, 32}});
......@@ -88,7 +88,7 @@ void pytorch_conv_relu_maxpool_x2()
EXPECT(p == prog);
}
void leaky_relu_test()
TEST_CASE(leaky_relu_test)
{
migraphx::program p;
float alpha = 0.01f;
......@@ -100,7 +100,7 @@ void leaky_relu_test()
EXPECT(p == prog);
}
void imagescaler_test()
TEST_CASE(imagescaler_test)
{
migraphx::program p;
migraphx::shape s{migraphx::shape::float_type, {1, 3, 16, 16}};
......@@ -118,7 +118,7 @@ void imagescaler_test()
EXPECT(p == prog);
}
void globalavgpool_test()
TEST_CASE(globalavgpool_test)
{
migraphx::program p;
auto input = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {1, 3, 16, 16}});
......@@ -132,7 +132,7 @@ void globalavgpool_test()
EXPECT(p == prog);
}
void globalmaxpool_test()
TEST_CASE(globalmaxpool_test)
{
migraphx::program p;
auto input = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {1, 3, 16, 16}});
......@@ -146,7 +146,7 @@ void globalmaxpool_test()
EXPECT(p == prog);
}
void transpose_test()
TEST_CASE(transpose_test)
{
migraphx::program p;
auto input = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {1, 2, 2, 3}});
......@@ -158,7 +158,7 @@ void transpose_test()
EXPECT(p == prog);
}
void dropout_test()
TEST_CASE(dropout_test)
{
migraphx::program p;
auto input = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {1, 3, 2, 2}});
......@@ -169,7 +169,7 @@ void dropout_test()
EXPECT(p == prog);
}
void sum_test()
TEST_CASE(sum_test)
{
migraphx::program p;
auto input0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {3}});
......@@ -182,7 +182,7 @@ void sum_test()
EXPECT(p == prog);
}
void exp_test()
TEST_CASE(exp_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {10}});
......@@ -192,7 +192,7 @@ void exp_test()
EXPECT(p == prog);
}
void log_test()
TEST_CASE(log_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {10}});
......@@ -202,7 +202,7 @@ void log_test()
EXPECT(p == prog);
}
void sin_test()
TEST_CASE(sin_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {10}});
......@@ -212,7 +212,7 @@ void sin_test()
EXPECT(p == prog);
}
void cos_test()
TEST_CASE(cos_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {10}});
......@@ -222,7 +222,7 @@ void cos_test()
EXPECT(p == prog);
}
void tan_test()
TEST_CASE(tan_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {10}});
......@@ -232,7 +232,7 @@ void tan_test()
EXPECT(p == prog);
}
void sinh_test()
TEST_CASE(sinh_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {10}});
......@@ -243,7 +243,7 @@ void sinh_test()
EXPECT(p == prog);
}
void cosh_test()
TEST_CASE(cosh_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1}});
......@@ -254,7 +254,7 @@ void cosh_test()
EXPECT(p == prog);
}
void tanh_test()
TEST_CASE(tanh_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1}});
......@@ -265,7 +265,18 @@ void tanh_test()
EXPECT(p == prog);
}
void asin_test()
TEST_CASE(elu_test)
{
migraphx::program p;
auto input = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {3}});
p.add_instruction(migraphx::op::elu{0.01}, input);
auto prog = migraphx::parse_onnx("elu_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(asin_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {10}});
......@@ -276,7 +287,7 @@ void asin_test()
EXPECT(p == prog);
}
void max_test()
TEST_CASE(max_test)
{
migraphx::program p;
auto input0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {3}});
......@@ -288,7 +299,7 @@ void max_test()
auto prog = migraphx::parse_onnx("max_test.onnx");
}
void acos_test()
TEST_CASE(acos_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {10}});
......@@ -299,7 +310,7 @@ void acos_test()
EXPECT(p == prog);
}
void min_test()
TEST_CASE(min_test)
{
migraphx::program p;
auto input0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {3}});
......@@ -311,7 +322,7 @@ void min_test()
auto prog = migraphx::parse_onnx("min_test.onnx");
}
void atan_test()
TEST_CASE(atan_test)
{
migraphx::program p;
auto input = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {10}});
......@@ -322,30 +333,156 @@ void atan_test()
EXPECT(p == prog);
}
int main()
{
pytorch_conv_bias_test();
pytorch_conv_relu_maxpool();
pytorch_conv_bn_relu_maxpool();
pytorch_conv_relu_maxpool_x2();
leaky_relu_test();
imagescaler_test();
globalavgpool_test();
globalmaxpool_test();
transpose_test();
dropout_test();
sum_test();
max_test();
min_test();
exp_test();
log_test();
sin_test();
cos_test();
tan_test();
sinh_test();
cosh_test();
tanh_test();
asin_test();
acos_test();
atan_test();
TEST_CASE(add_bcast_test)
{
migraphx::program p;
auto l0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {2, 3, 4, 5}});
auto l1 = p.add_parameter("1", migraphx::shape{migraphx::shape::float_type, {3, 4}});
auto l2 = p.add_instruction(migraphx::op::broadcast{1, l0->get_shape()}, l1);
p.add_instruction(migraphx::op::add{}, l0, l2);
auto prog = migraphx::parse_onnx("add_bcast_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(implicit_bcast_test)
{
migraphx::program p;
auto l0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {2, 3, 4, 5}});
auto l1 = p.add_parameter("1", migraphx::shape{migraphx::shape::float_type, {3, 4}});
auto l2 = p.add_instruction(migraphx::op::multibroadcast{{0, 0, 4, 5}}, l0);
auto l3 = p.add_instruction(migraphx::op::multibroadcast{{0, 0, 4, 5}}, l1);
p.add_instruction(migraphx::op::add{}, l2, l3);
auto prog = migraphx::parse_onnx("implicit_bcast_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(unknown_test)
{
migraphx::program p;
auto l0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {2, 3, 4, 5}});
auto l1 = p.add_parameter("1", migraphx::shape{migraphx::shape::float_type, {3, 4}});
auto l2 = p.add_instruction(migraphx::unknown{"Unknown"}, l0, l1);
p.add_instruction(migraphx::unknown{"Unknown"}, l2);
auto prog = migraphx::parse_onnx("unknown_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(softmax_test)
{
migraphx::program p;
auto l0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {1, 3}});
auto r = p.add_instruction(migraphx::op::reshape{{1, 3, 1, 1}}, l0);
auto s = p.add_instruction(migraphx::op::softmax{}, r);
p.add_instruction(migraphx::op::reshape{{1, 3}}, s);
auto prog = migraphx::parse_onnx("softmax_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(reshape_test)
{
migraphx::program p;
migraphx::op::reshape op;
std::vector<int64_t> reshape_dims{3, 8};
auto l0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {4, 2, 3}});
p.add_literal(
migraphx::literal{migraphx::shape{migraphx::shape::int64_type, {2}}, reshape_dims});
op.dims = reshape_dims;
p.add_instruction(op, l0);
p.add_instruction(op, l0);
auto prog = migraphx::parse_onnx("reshape_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(flatten_test)
{
migraphx::program p;
auto l0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {2, 3, 4, 5}});
p.add_instruction(migraphx::op::flatten{1}, l0);
p.add_instruction(migraphx::op::flatten{2}, l0);
auto prog = migraphx::parse_onnx("flatten_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(squeeze_unsqueeze_test)
{
migraphx::program p;
std::vector<int64_t> squeeze_axes{0, 2, 3, 5};
std::vector<int64_t> unsqueeze_axes{0, 1, 3, 5};
auto l0 =
p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {1, 3, 1, 1, 2, 1}});
auto l1 = p.add_instruction(migraphx::op::squeeze{squeeze_axes}, l0);
p.add_instruction(migraphx::op::unsqueeze{unsqueeze_axes}, l1);
auto prog = migraphx::parse_onnx("squeeze_unsqueeze_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(concat_test)
{
migraphx::program p;
auto l0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {2, 4, 3}});
auto l1 = p.add_parameter("1", migraphx::shape{migraphx::shape::float_type, {7, 4, 3}});
p.add_instruction(migraphx::op::concat{0}, l0, l1);
auto prog = migraphx::parse_onnx("concat_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(slice_test)
{
migraphx::program p;
auto l0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {3, 2}});
p.add_instruction(migraphx::op::slice{{0, 1}, {1, 0}, {2, 2}}, l0);
auto prog = migraphx::parse_onnx("slice_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(constant_test)
{
migraphx::program p;
p.add_literal(migraphx::literal{migraphx::shape{migraphx::shape::float_type, {3}}, {0, 1, 2}});
auto prog = migraphx::parse_onnx("constant_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(gemm_test)
{
migraphx::program p;
auto l0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {5, 7}});
auto l1 = p.add_parameter("1", migraphx::shape{migraphx::shape::float_type, {11, 5}});
auto l2 = p.add_parameter("2", migraphx::shape{migraphx::shape::float_type, {}});
auto t0 = p.add_instruction(migraphx::op::transpose{{1, 0}}, l0);
auto t1 = p.add_instruction(migraphx::op::transpose{{1, 0}}, l1);
auto d0 = p.add_instruction(migraphx::op::dot{2, 2}, t0, t1);
auto b0 = p.add_instruction(migraphx::op::broadcast{1, d0->get_shape()}, l2);
p.add_instruction(migraphx::op::add{}, d0, b0);
auto prog = migraphx::parse_onnx("gemm_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(add_scalar_test)
{
migraphx::program p;
auto l0 = p.add_parameter("0", migraphx::shape{migraphx::shape::float_type, {2, 3, 4, 5}});
auto l1 =
p.add_literal(migraphx::literal{migraphx::shape{migraphx::shape::float_type, {1}}, {1}});
auto m0 = p.add_instruction(migraphx::op::multibroadcast{{0, 0, 0, 5}}, l0);
auto m1 = p.add_instruction(migraphx::op::multibroadcast{{0, 0, 0, 5}}, l1);
p.add_instruction(migraphx::op::add{}, m0, m1);
auto prog = migraphx::parse_onnx("add_scalar_test.onnx");
EXPECT(p == prog);
}
int main(int argc, const char* argv[]) { test::run(argc, argv); }
reshape-example:

0
12"Reshape

03"Reshape*
shape@@ test-reshape* :B1Z
0



Z
1

b
2


b
3


B
\ No newline at end of file
softmax-example:I

01"Softmax test-softmaxZ
0


b
1


B
\ No newline at end of file
unknown-example:

0
12"Unknown
2"Unknown test-unknownZ
0




Z
1


b
2




B
\ No newline at end of file
#ifndef MIGRAPH_GUARD_CONCAT_OPT_HPP
#define MIGRAPH_GUARD_CONCAT_OPT_HPP
#ifndef MIGRAPHX_GUARD_CONCAT_OPT_HPP
#define MIGRAPHX_GUARD_CONCAT_OPT_HPP
#include <cassert>
#include <string>
......@@ -10,8 +10,10 @@
#include <migraphx/operation.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/config.hpp>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
struct program;
......@@ -40,6 +42,7 @@ interface('concat_optimization',
#endif
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
#endif
#ifndef MIGRAPH_GUARD_CONTEXT_HPP
#define MIGRAPH_GUARD_CONTEXT_HPP
#ifndef MIGRAPHX_GUARD_CONTEXT_HPP
#define MIGRAPHX_GUARD_CONTEXT_HPP
#include <cassert>
#include <string>
......@@ -7,8 +7,10 @@
#include <memory>
#include <type_traits>
#include <utility>
#include <migraphx/config.hpp>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
#ifdef DOXYGEN
......@@ -31,6 +33,7 @@ interface('context',
#endif
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
#endif
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_OPERAND_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_OPERAND_HPP
#ifndef MIGRAPHX_GUARD_MIGRAPHLIB_OPERAND_HPP
#define MIGRAPHX_GUARD_MIGRAPHLIB_OPERAND_HPP
#include <cassert>
#include <string>
......@@ -13,8 +13,10 @@
#include <migraphx/argument.hpp>
#include <migraphx/context.hpp>
#include <migraphx/auto_any_cast.hpp>
#include <migraphx/config.hpp>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
#ifdef DOXYGEN
......@@ -101,7 +103,7 @@ template <class T>
argument compute_op(rank<0>, const T& x, context&, const shape&, const std::vector<argument>&)
{
std::string name = x.name();
MIGRAPH_THROW("Not computable: " + name);
MIGRAPHX_THROW("Not computable: " + name);
}
template <class T>
......@@ -165,6 +167,7 @@ int output_alias_op(const T& x, const std::vector<shape>& shapes)
#endif
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
#endif
#ifndef MIGRAPH_GUARD_PASS_HPP
#define MIGRAPH_GUARD_PASS_HPP
#ifndef MIGRAPHX_GUARD_PASS_HPP
#define MIGRAPHX_GUARD_PASS_HPP
#include <cassert>
#include <string>
......@@ -7,8 +7,10 @@
#include <memory>
#include <type_traits>
#include <utility>
#include <migraphx/config.hpp>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
struct program;
......@@ -35,6 +37,7 @@ interface('pass',
#endif
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
#endif
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_TARGET_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_TARGET_HPP
#ifndef MIGRAPHX_GUARD_MIGRAPHLIB_TARGET_HPP
#define MIGRAPHX_GUARD_MIGRAPHLIB_TARGET_HPP
#include <cassert>
#include <string>
......@@ -10,8 +10,10 @@
#include <vector>
#include <migraphx/context.hpp>
#include <migraphx/pass.hpp>
#include <migraphx/config.hpp>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
#ifdef DOXYGEN
......@@ -48,6 +50,7 @@ interface('target',
#endif
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment