"official/benchmark/transformer_benchmark.py" did not exist on "080347bc9056fdb8f0a2236ccdb5bfef1cdf0cca"
Commit 3272b22e authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent 94e3a2e4
......@@ -94,9 +94,7 @@ void set_nhwc(tf_options& options, bool is_nhwc) { options.is_nhwc = is_nhwc; }
void set_default_dim_value(tf_options& options, size_t value) { options.batch_size = value; }
void set_input_parameter_shape(onnx_options& options,
const char* name,
std::vector<int> dims)
void set_input_parameter_shape(onnx_options& options, const char* name, std::vector<int> dims)
{
options.map_input_dims[std::string(name)] = std::move(dims);
}
......@@ -855,7 +853,8 @@ migraphx_operation_name(char* out, int out_size, migraphx_operation_t operation)
if(operation == nullptr)
MIGRAPHX_THROW(migraphx_status_bad_param, "Bad parameter operation: Null pointer");
auto&& api_result = (operation->object).name();
auto* it = std::copy_n(api_result.begin(), std::min(static_cast<int>(api_result.size()), out_size - 1), out);
auto* it = std::copy_n(
api_result.begin(), std::min(static_cast<int>(api_result.size()), out_size - 1), out);
*it = '\0';
});
return api_error_result;
......
......@@ -235,9 +235,7 @@ struct shape : MIGRAPHX_CONST_HANDLE_BASE(shape)
this->make_handle(&migraphx_shape_create, type, plengths.data(), plengths.size());
}
shape(migraphx_shape_datatype_t type,
std::vector<int> plengths,
std::vector<int> pstrides)
shape(migraphx_shape_datatype_t type, std::vector<int> plengths, std::vector<int> pstrides)
{
this->make_handle(&migraphx_shape_create_with_strides,
type,
......@@ -699,8 +697,7 @@ inline program parse_onnx(const char* filename)
}
/// Parse a buffer of memory as an onnx file
inline program
parse_onnx_buffer(const void* data, int size, const migraphx::onnx_options& options)
inline program parse_onnx_buffer(const void* data, int size, const migraphx::onnx_options& options)
{
return program(
make<migraphx_program>(&migraphx_parse_onnx_buffer, data, size, options.get_handle_ptr()),
......
......@@ -15,8 +15,7 @@ struct file_options
program load(const std::string& filename, const file_options& options = file_options{});
program load_buffer(const std::vector<char>& buffer, const file_options& options = file_options{});
program
load_buffer(const char* buffer, int size, const file_options& options = file_options{});
program load_buffer(const char* buffer, int size, const file_options& options = file_options{});
void save(const program& p,
const std::string& filename,
......
......@@ -21,12 +21,9 @@ auto par_dfor(Ts... xs)
{
array_type strides;
strides.fill(1);
std::partial_sum(lens.rbegin(),
lens.rend() - 1,
strides.rbegin() + 1,
std::multiplies<int>());
auto size =
std::accumulate(lens.begin(), lens.end(), 1, std::multiplies<int>());
std::partial_sum(
lens.rbegin(), lens.rend() - 1, strides.rbegin() + 1, std::multiplies<int>());
auto size = std::accumulate(lens.begin(), lens.end(), 1, std::multiplies<int>());
par_for(size, min_grain, [&](int i) {
array_type indices;
std::transform(strides.begin(),
......
......@@ -67,8 +67,7 @@ struct program
void finalize();
void
perf_report(std::ostream& os, int n, parameter_map params, int batch = 1) const;
void perf_report(std::ostream& os, int n, parameter_map params, int batch = 1) const;
void mark(const parameter_map& params, marker&& m);
......
......@@ -24,8 +24,7 @@ struct parse_gru : op_parser<parse_gru>
if(contains(info.attributes, "hidden_size"))
{
int hidden_size_att =
parser.parse_value(info.attributes.at("hidden_size")).at<int>();
int hidden_size_att = parser.parse_value(info.attributes.at("hidden_size")).at<int>();
if(hidden_size != hidden_size_att)
{
MIGRAPHX_THROW("GRU: hidden size mismatch in input and attribute");
......
......@@ -107,8 +107,7 @@ struct parse_lstm : op_parser<parse_lstm>
if(contains(info.attributes, "hidden_size"))
{
int hidden_size_att =
parser.parse_value(info.attributes.at("hidden_size")).at<int>();
int hidden_size_att = parser.parse_value(info.attributes.at("hidden_size")).at<int>();
if(hidden_size != hidden_size_att)
{
MIGRAPHX_THROW("LSTM: hidden size mismatch in input and attribute");
......
......@@ -45,10 +45,7 @@ const auto& get_original_idx_op(const std::string& mode)
{
using original_idx_op = std::function<double(int, int, int, double)>;
static std::unordered_map<std::string, original_idx_op> const idx_ops = {
{"half_pixel",
[=](int, int, int idx, double scale) {
return (idx + 0.5) / scale - 0.5;
}},
{"half_pixel", [=](int, int, int idx, double scale) { return (idx + 0.5) / scale - 0.5; }},
{"pytorch_half_pixel",
[=](int, int l_out, int idx, double scale) {
return l_out > 1 ? (idx + 0.5) / scale - 0.5 : 0.0;
......@@ -57,11 +54,9 @@ const auto& get_original_idx_op(const std::string& mode)
[=](int l_in, int l_out, int idx, double) {
return (l_out == 1) ? 0.0 : (1.0 * idx * (l_in - 1.0) / (l_out - 1.0));
}},
{"asymmetric",
[=](int, int, int idx, double scale) { return idx / scale; }},
{"tf_half_pixel_for_nn", [=](int, int, int idx, double scale) {
return (idx + 0.5) / scale;
}}};
{"asymmetric", [=](int, int, int idx, double scale) { return idx / scale; }},
{"tf_half_pixel_for_nn",
[=](int, int, int idx, double scale) { return (idx + 0.5) / scale; }}};
if(!contains(idx_ops, mode))
{
......@@ -251,13 +246,12 @@ struct parse_resize : op_parser<parse_resize>
": ranks of input and scale are different!");
}
std::transform(in_lens.begin(),
std::transform(
in_lens.begin(),
in_lens.end(),
vec_scale.begin(),
out_lens.begin(),
[&](auto idx, auto scale) {
return static_cast<int>(idx * scale);
});
[&](auto idx, auto scale) { return static_cast<int>(idx * scale); });
}
}
}
......
......@@ -24,8 +24,7 @@ struct parse_rnn : op_parser<parse_rnn>
if(contains(info.attributes, "hidden_size"))
{
int hidden_size_att =
parser.parse_value(info.attributes.at("hidden_size")).at<int>();
int hidden_size_att = parser.parse_value(info.attributes.at("hidden_size")).at<int>();
if(hidden_size != hidden_size_att)
{
MIGRAPHX_THROW("RNN: hidden size mismatch in input and attribute");
......
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