Unverified Commit 90633bbb authored by kahmed10's avatar kahmed10 Committed by GitHub
Browse files

add fill0 (#595)


Co-authored-by: default avatarmvermeulen <5479696+mvermeulen@users.noreply.github.com>
Co-authored-by: default avatarShucai Xiao <shucai.xiao@amd.com>
parent f16215d6
...@@ -123,6 +123,7 @@ struct compiler ...@@ -123,6 +123,7 @@ struct compiler
bool offload_copy = false; bool offload_copy = false;
int quantize = 0; int quantize = 0;
std::vector<std::string> fill0;
std::vector<std::string> fill1; std::vector<std::string> fill1;
void parse(argument_parser& ap) void parse(argument_parser& ap)
{ {
...@@ -135,6 +136,7 @@ struct compiler ...@@ -135,6 +136,7 @@ struct compiler
ap.set_value(true)); ap.set_value(true));
ap(quantize, {"--fp16"}, ap.help("Quantize for fp16"), ap.set_value(q_fp16)); ap(quantize, {"--fp16"}, ap.help("Quantize for fp16"), ap.set_value(q_fp16));
ap(quantize, {"--int8"}, ap.help("Quantize for int8"), ap.set_value(q_int8)); ap(quantize, {"--int8"}, ap.help("Quantize for int8"), ap.set_value(q_int8));
ap(fill0, {"--fill0"}, ap.help("Fill parameter with 0s"), ap.append());
ap(fill1, {"--fill1"}, ap.help("Fill parameter with 1s"), ap.append()); ap(fill1, {"--fill1"}, ap.help("Fill parameter with 1s"), ap.append());
} }
...@@ -142,6 +144,8 @@ struct compiler ...@@ -142,6 +144,8 @@ struct compiler
{ {
bool gpu_flag = use_gpu && gpu && !offload_copy; bool gpu_flag = use_gpu && gpu && !offload_copy;
program::parameter_map m; program::parameter_map m;
for(auto&& s : fill0)
m[s] = fill_argument(p.get_parameter_shape(s), 0);
for(auto&& s : fill1) for(auto&& s : fill1)
m[s] = fill_argument(p.get_parameter_shape(s), 1); m[s] = fill_argument(p.get_parameter_shape(s), 1);
fill_param_map(m, p, gpu_flag); fill_param_map(m, p, gpu_flag);
......
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