Commit 94e3a2e4 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

change size_t to int

parent 26bd92d8
......@@ -8,7 +8,7 @@
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
bool happens_before(const std::vector<std::size_t>& e1, const std::vector<std::size_t>& e2)
bool happens_before(const std::vector<int>& e1, const std::vector<int>& e2)
{
return std::equal(e1.begin(), e1.end(), e2.begin(), e2.end(), std::less_equal<>{}) and
not std::equal(e1.begin(), e1.end(), e2.begin(), e2.end(), std::greater_equal<>{});
......@@ -16,17 +16,17 @@ bool happens_before(const std::vector<std::size_t>& e1, const std::vector<std::s
std::vector<stream_race> analyze_streams(const module& p, const stream_model& m)
{
using vector_clock = std::vector<std::size_t>;
using vector_clock = std::vector<int>;
std::vector<stream_race> races;
auto nstream = m.get_nstream();
std::vector<vector_clock> vclock(nstream, vector_clock(nstream));
std::unordered_map<instruction_ref, vector_clock> timestamp;
std::unordered_map<std::size_t, vector_clock> events;
std::unordered_map<int, vector_clock> events;
for(auto ins : iterator_for(p))
{
if(not m.has_stream(ins))
continue;
std::size_t s = m.get_stream(ins);
int s = m.get_stream(ins);
assert(s < nstream);
assert(vclock.size() == nstream);
assert(vclock[s].size() == nstream);
......@@ -63,7 +63,7 @@ std::vector<stream_race> analyze_streams(const module& p, const stream_model& m)
continue;
if(ins->inputs().empty())
continue;
std::size_t s = m.get_stream(ins);
int s = m.get_stream(ins);
// Find inputs from different streams
std::vector<instruction_ref> inputs;
fix([&](auto self, auto start) {
......
......@@ -96,12 +96,12 @@ void set_default_dim_value(tf_options& options, size_t value) { options.batch_si
void set_input_parameter_shape(onnx_options& options,
const char* name,
std::vector<std::size_t> dims)
std::vector<int> dims)
{
options.map_input_dims[std::string(name)] = std::move(dims);
}
void set_input_parameter_shape(tf_options& options, const char* name, std::vector<std::size_t> dims)
void set_input_parameter_shape(tf_options& options, const char* name, std::vector<int> dims)
{
options.map_input_dims[std::string(name)] = std::move(dims);
}
......@@ -388,7 +388,7 @@ extern "C" migraphx_status migraphx_shape_destroy(migraphx_shape_t shape)
extern "C" migraphx_status migraphx_shape_create(migraphx_shape_t* shape,
migraphx_shape_datatype_t type,
size_t* lengths,
size_t lengths_size)
int lengths_size)
{
auto api_error_result = migraphx::try_([&] {
if(lengths == nullptr and lengths_size != 0)
......@@ -403,9 +403,9 @@ extern "C" migraphx_status migraphx_shape_create(migraphx_shape_t* shape,
extern "C" migraphx_status migraphx_shape_create_with_strides(migraphx_shape_t* shape,
migraphx_shape_datatype_t type,
size_t* lengths,
size_t lengths_size,
int lengths_size,
size_t* strides,
size_t strides_size)
int strides_size)
{
auto api_error_result = migraphx::try_([&] {
if(lengths == nullptr and lengths_size != 0)
......@@ -431,7 +431,7 @@ extern "C" migraphx_status migraphx_shape_create_scalar(migraphx_shape_t* shape,
}
extern "C" migraphx_status
migraphx_shape_lengths(const size_t** out, size_t* out_size, const_migraphx_shape_t shape)
migraphx_shape_lengths(const int** out, int* out_size, const_migraphx_shape_t shape)
{
auto api_error_result = migraphx::try_([&] {
if(out == nullptr or out_size == nullptr)
......@@ -446,7 +446,7 @@ migraphx_shape_lengths(const size_t** out, size_t* out_size, const_migraphx_shap
}
extern "C" migraphx_status
migraphx_shape_strides(const size_t** out, size_t* out_size, const_migraphx_shape_t shape)
migraphx_shape_strides(const int** out, int* out_size, const_migraphx_shape_t shape)
{
auto api_error_result = migraphx::try_([&] {
if(out == nullptr or out_size == nullptr)
......@@ -847,7 +847,7 @@ extern "C" migraphx_status migraphx_operation_create(migraphx_operation_t* opera
}
extern "C" migraphx_status
migraphx_operation_name(char* out, size_t out_size, migraphx_operation_t operation)
migraphx_operation_name(char* out, int out_size, migraphx_operation_t operation)
{
auto api_error_result = migraphx::try_([&] {
if(out == nullptr)
......@@ -855,7 +855,7 @@ migraphx_operation_name(char* out, size_t out_size, migraphx_operation_t operati
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(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;
......@@ -900,7 +900,7 @@ extern "C" migraphx_status migraphx_onnx_options_create(migraphx_onnx_options_t*
}
extern "C" migraphx_status migraphx_onnx_options_set_input_parameter_shape(
migraphx_onnx_options_t onnx_options, const char* name, size_t* dims, size_t dims_size)
migraphx_onnx_options_t onnx_options, const char* name, size_t* dims, int dims_size)
{
auto api_error_result = migraphx::try_([&] {
if(onnx_options == nullptr)
......@@ -908,7 +908,7 @@ extern "C" migraphx_status migraphx_onnx_options_set_input_parameter_shape(
if(dims == nullptr and dims_size != 0)
MIGRAPHX_THROW(migraphx_status_bad_param, "Bad parameter dims: Null pointer");
migraphx::set_input_parameter_shape(
(onnx_options->object), (name), (std::vector<size_t>(dims, dims + dims_size)));
(onnx_options->object), (name), (std::vector<int>(dims, dims + dims_size)));
});
return api_error_result;
}
......@@ -1053,7 +1053,7 @@ extern "C" migraphx_status migraphx_tf_options_set_nhwc(migraphx_tf_options_t tf
}
extern "C" migraphx_status migraphx_tf_options_set_input_parameter_shape(
migraphx_tf_options_t tf_options, const char* name, size_t* dims, size_t dims_size)
migraphx_tf_options_t tf_options, const char* name, int* dims, int dims_size)
{
auto api_error_result = migraphx::try_([&] {
if(tf_options == nullptr)
......@@ -1061,7 +1061,7 @@ extern "C" migraphx_status migraphx_tf_options_set_input_parameter_shape(
if(dims == nullptr and dims_size != 0)
MIGRAPHX_THROW(migraphx_status_bad_param, "Bad parameter dims: Null pointer");
migraphx::set_input_parameter_shape(
(tf_options->object), (name), (std::vector<size_t>(dims, dims + dims_size)));
(tf_options->object), (name), (std::vector<int>(dims, dims + dims_size)));
});
return api_error_result;
}
......@@ -1079,7 +1079,7 @@ migraphx_tf_options_set_default_dim_value(migraphx_tf_options_t tf_options, size
extern "C" migraphx_status migraphx_tf_options_set_output_names(migraphx_tf_options_t tf_options,
const char** names,
size_t names_size)
int names_size)
{
auto api_error_result = migraphx::try_([&] {
if(tf_options == nullptr)
......
......@@ -94,23 +94,23 @@ migraphx_status migraphx_shape_destroy(migraphx_shape_t shape);
migraphx_status migraphx_shape_create(migraphx_shape_t* shape,
migraphx_shape_datatype_t type,
size_t* lengths,
size_t lengths_size);
int lengths_size);
migraphx_status migraphx_shape_create_with_strides(migraphx_shape_t* shape,
migraphx_shape_datatype_t type,
size_t* lengths,
size_t lengths_size,
int lengths_size,
size_t* strides,
size_t strides_size);
int strides_size);
migraphx_status migraphx_shape_create_scalar(migraphx_shape_t* shape,
migraphx_shape_datatype_t type);
migraphx_status
migraphx_shape_lengths(const size_t** out, size_t* out_size, const_migraphx_shape_t shape);
migraphx_shape_lengths(const int** out, int* out_size, const_migraphx_shape_t shape);
migraphx_status
migraphx_shape_strides(const size_t** out, size_t* out_size, const_migraphx_shape_t shape);
migraphx_shape_strides(const int** out, int* out_size, const_migraphx_shape_t shape);
migraphx_status migraphx_shape_type(migraphx_shape_datatype_t* out, const_migraphx_shape_t shape);
......@@ -212,7 +212,7 @@ migraphx_status migraphx_operation_create(migraphx_operation_t* operation,
const char* attributes,
...);
migraphx_status migraphx_operation_name(char* out, size_t out_size, migraphx_operation_t operation);
migraphx_status migraphx_operation_name(char* out, int out_size, migraphx_operation_t operation);
migraphx_status
migraphx_load(migraphx_program_t* out, const char* name, migraphx_file_options_t options);
......@@ -225,7 +225,7 @@ migraphx_status migraphx_onnx_options_destroy(migraphx_onnx_options_t onnx_optio
migraphx_status migraphx_onnx_options_create(migraphx_onnx_options_t* onnx_options);
migraphx_status migraphx_onnx_options_set_input_parameter_shape(
migraphx_onnx_options_t onnx_options, const char* name, size_t* dims, size_t dims_size);
migraphx_onnx_options_t onnx_options, const char* name, size_t* dims, int dims_size);
migraphx_status migraphx_onnx_options_set_default_dim_value(migraphx_onnx_options_t onnx_options,
size_t value);
......@@ -267,15 +267,15 @@ migraphx_status migraphx_tf_options_set_nhwc(migraphx_tf_options_t tf_options, b
migraphx_status migraphx_tf_options_set_input_parameter_shape(migraphx_tf_options_t tf_options,
const char* name,
size_t* dims,
size_t dims_size);
int* dims,
int dims_size);
migraphx_status migraphx_tf_options_set_default_dim_value(migraphx_tf_options_t tf_options,
size_t value);
migraphx_status migraphx_tf_options_set_output_names(migraphx_tf_options_t tf_options,
const char** names,
size_t names_size);
int names_size);
migraphx_status
migraphx_parse_tf(migraphx_program_t* out, const char* name, migraphx_tf_options_t options);
......
......@@ -37,7 +37,7 @@ void call(F f, Ts&&... xs)
throw std::runtime_error("Failed to call function");
}
template <class F, class Iterator = std::size_t>
template <class F, class Iterator = int>
struct iota_iterator
{
Iterator index;
......@@ -230,14 +230,14 @@ struct shape : MIGRAPHX_CONST_HANDLE_BASE(shape)
/// Construct a shape with its type and lengths. The strides are
/// automatically computed assumming a packed layout.
shape(migraphx_shape_datatype_t type, std::vector<size_t> plengths)
shape(migraphx_shape_datatype_t type, std::vector<int> plengths)
{
this->make_handle(&migraphx_shape_create, type, plengths.data(), plengths.size());
}
shape(migraphx_shape_datatype_t type,
std::vector<size_t> plengths,
std::vector<size_t> pstrides)
std::vector<int> plengths,
std::vector<int> pstrides)
{
this->make_handle(&migraphx_shape_create_with_strides,
type,
......@@ -247,18 +247,18 @@ struct shape : MIGRAPHX_CONST_HANDLE_BASE(shape)
pstrides.size());
}
std::vector<size_t> lengths() const
std::vector<int> lengths() const
{
const size_t* pout;
size_t pout_size;
const int* pout;
int pout_size;
call(&migraphx_shape_lengths, &pout, &pout_size, this->get_handle_ptr());
return {pout, pout + pout_size};
}
std::vector<size_t> strides() const
std::vector<int> strides() const
{
const size_t* pout;
size_t pout_size;
const int* pout;
int pout_size;
call(&migraphx_shape_strides, &pout, &pout_size, this->get_handle_ptr());
return {pout, pout + pout_size};
}
......@@ -270,9 +270,9 @@ struct shape : MIGRAPHX_CONST_HANDLE_BASE(shape)
return pout;
}
size_t bytes() const
int bytes() const
{
size_t pout;
int pout;
call(&migraphx_shape_bytes, &pout, this->get_handle_ptr());
return pout;
}
......@@ -323,7 +323,7 @@ struct argument : MIGRAPHX_CONST_HANDLE_BASE(argument)
}
/// Generate an argument using random data
static argument generate(shape ps, size_t pseed = 0)
static argument generate(shape ps, int pseed = 0)
{
return {make<migraphx_argument>(&migraphx_argument_generate, ps.get_handle_ptr(), pseed),
own{}};
......@@ -366,9 +366,9 @@ struct program_parameter_shapes : MIGRAPHX_HANDLE_BASE(program_parameter_shapes)
this->set_handle(p, borrow{});
}
size_t size() const
int size() const
{
size_t pout;
int pout;
call(&migraphx_program_parameter_shapes_size, &pout, this->get_handle_ptr());
return pout;
}
......@@ -426,14 +426,14 @@ struct arguments : MIGRAPHX_HANDLE_BASE(arguments), array_base<arguments>
arguments(migraphx_arguments* p, borrow) { this->set_handle(p, borrow{}); }
size_t size() const
int size() const
{
size_t pout;
int pout;
call(&migraphx_arguments_size, &pout, this->get_handle_ptr());
return pout;
}
argument operator[](size_t pidx) const
argument operator[](int pidx) const
{
const_migraphx_argument_t pout;
call(&migraphx_arguments_get, &pout, this->get_handle_ptr(), pidx);
......@@ -443,7 +443,7 @@ struct arguments : MIGRAPHX_HANDLE_BASE(arguments), array_base<arguments>
struct iterator_read
{
migraphx_arguments* self;
argument operator()(size_t pidx) const
argument operator()(int pidx) const
{
const_migraphx_argument_t pout;
call(&migraphx_arguments_get, &pout, self, pidx);
......@@ -459,14 +459,14 @@ struct shapes : MIGRAPHX_HANDLE_BASE(shapes), array_base<shapes>
shapes(migraphx_shapes* p, borrow) { this->set_handle(p, borrow{}); }
size_t size() const
int size() const
{
size_t pout;
int pout;
call(&migraphx_shapes_size, &pout, this->get_handle_ptr());
return pout;
}
shape operator[](size_t pidx) const
shape operator[](int pidx) const
{
const_migraphx_shape_t pout;
call(&migraphx_shapes_get, &pout, this->get_handle_ptr(), pidx);
......@@ -476,7 +476,7 @@ struct shapes : MIGRAPHX_HANDLE_BASE(shapes), array_base<shapes>
struct iterator_read
{
migraphx_shapes* self;
shape operator()(size_t pidx) const
shape operator()(int pidx) const
{
const_migraphx_shape_t pout;
call(&migraphx_shapes_get, &pout, self, pidx);
......@@ -661,7 +661,7 @@ struct onnx_options : MIGRAPHX_HANDLE_BASE(onnx_options)
onnx_options(migraphx_onnx_options* p, own) { this->set_handle(p, own{}); }
/// Make onnx parser treat an inputs with a certain dimensions
void set_input_parameter_shape(const std::string& name, std::vector<std::size_t> dim)
void set_input_parameter_shape(const std::string& name, std::vector<int> dim)
{
call(&migraphx_onnx_options_set_input_parameter_shape,
this->get_handle_ptr(),
......@@ -700,7 +700,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, size_t size, const migraphx::onnx_options& options)
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()),
......@@ -708,7 +708,7 @@ parse_onnx_buffer(const void* data, size_t size, const migraphx::onnx_options& o
}
/// Parse a buffer of memory as an onnx file
inline program parse_onnx_buffer(const void* data, size_t size)
inline program parse_onnx_buffer(const void* data, int size)
{
migraphx::onnx_options options;
return program(
......@@ -743,7 +743,7 @@ struct tf_options : MIGRAPHX_HANDLE_BASE(tf_options)
tf_options(migraphx_tf_options* p, own) { this->set_handle(p, own{}); }
/// Make tf parser treat an inputs with a certain dimensions
void set_input_parameter_shape(const std::string& name, std::vector<std::size_t> dim)
void set_input_parameter_shape(const std::string& name, std::vector<int> dim)
{
call(&migraphx_tf_options_set_input_parameter_shape,
this->get_handle_ptr(),
......
......@@ -27,10 +27,10 @@ void argument::assign_buffer(std::function<char*()> d)
return;
}
// Collect all shapes
std::unordered_map<std::size_t, shape> shapes;
std::unordered_map<int, shape> shapes;
{
// cppcheck-suppress variableScope
std::size_t i = 0;
int i = 0;
fix([&](auto self, auto ss) {
if(ss.sub_shapes().empty())
{
......@@ -45,14 +45,14 @@ void argument::assign_buffer(std::function<char*()> d)
})(s);
}
// Sort by type size
std::vector<std::size_t> order(shapes.size());
std::vector<int> order(shapes.size());
std::iota(order.begin(), order.end(), 0);
std::sort(order.begin(), order.end(), by(std::greater<>{}, [&](auto i) {
return shapes[i].type_size();
}));
// Compute offsets
std::unordered_map<std::size_t, std::size_t> offsets;
std::size_t offset = 0;
std::unordered_map<int, int> offsets;
int offset = 0;
for(auto i : order)
{
offsets[i] = offset;
......@@ -61,7 +61,7 @@ void argument::assign_buffer(std::function<char*()> d)
assert(offset == s.bytes());
// cppcheck-suppress variableScope
std::size_t i = 0;
int i = 0;
m_data = fix<data_t>([&](auto self, auto ss) {
data_t result;
if(ss.sub_shapes().empty())
......@@ -155,7 +155,7 @@ std::vector<argument> argument::get_sub_objects() const
return result;
}
argument argument::element(std::size_t i) const
argument argument::element(int i) const
{
assert(this->get_shape().sub_shapes().empty());
auto idx = this->get_shape().index(i);
......
......@@ -86,7 +86,7 @@ cpp_generator::function& cpp_generator::function::set_generic_types(const module
struct cpp_generator_impl
{
std::stringstream fs{};
std::size_t function_count = 0;
int function_count = 0;
std::function<std::string(std::string)> fmap = nullptr;
std::function<std::string(shape)> fresult = nullptr;
std::unordered_map<std::string, std::string> point_op_map = {};
......
......@@ -14,7 +14,7 @@ std::ptrdiff_t bidistance(const Range& r, Iterator start, Iterator last)
{
auto start_forward = start;
auto start_backwards = start;
std::size_t n = 0;
int n = 0;
while(start_forward != last and start_backwards != last)
{
n++;
......
......@@ -8,7 +8,7 @@ namespace migraphx {
namespace driver {
inline namespace MIGRAPHX_INLINE_NS {
migraphx::program alexnet(unsigned batch) // NOLINT(readability-function-size)
migraphx::program alexnet(int batch) // NOLINT(readability-function-size)
{
migraphx::program p;
auto* mm = p.get_main_module();
......
......@@ -8,7 +8,7 @@ namespace migraphx {
namespace driver {
inline namespace MIGRAPHX_INLINE_NS {
migraphx::program inceptionv3(unsigned batch) // NOLINT(readability-function-size)
migraphx::program inceptionv3(int batch) // NOLINT(readability-function-size)
{
migraphx::program p;
auto* mm = p.get_main_module();
......
......@@ -37,7 +37,7 @@ struct loader
std::string model;
std::string file;
std::string file_type;
unsigned batch = 1;
int batch = 1;
bool is_nhwc = true;
unsigned trim = 0;
bool optimize = false;
......@@ -99,7 +99,7 @@ struct loader
static auto parse_param_dims(const std::vector<std::string>& param_dims_info)
{
std::unordered_map<std::string, std::vector<std::size_t>> map_input_dims;
std::unordered_map<std::string, std::vector<int>> map_input_dims;
std::string name = "";
for(auto&& x : param_dims_info)
{
......@@ -109,7 +109,7 @@ struct loader
}
else
{
map_input_dims[name].push_back(value_parser<std::size_t>::apply(x));
map_input_dims[name].push_back(value_parser<int>::apply(x));
}
}
......
......@@ -5,9 +5,9 @@ namespace migraphx {
namespace driver {
inline namespace MIGRAPHX_INLINE_NS {
migraphx::program resnet50(unsigned batch);
migraphx::program inceptionv3(unsigned batch);
migraphx::program alexnet(unsigned batch);
migraphx::program resnet50(int batch);
migraphx::program inceptionv3(int batch);
migraphx::program alexnet(int batch);
} // namespace MIGRAPHX_INLINE_NS
} // namespace driver
......
......@@ -8,7 +8,7 @@ namespace migraphx {
namespace driver {
inline namespace MIGRAPHX_INLINE_NS {
migraphx::program resnet50(unsigned batch) // NOLINT(readability-function-size)
migraphx::program resnet50(int batch) // NOLINT(readability-function-size)
{
migraphx::program p;
auto* mm = p.get_main_module();
......
......@@ -58,8 +58,8 @@ void verify_program(const std::string& name,
auto x = run_ref(p, inputs);
auto y = run_target(p, t, options, quantize, inputs);
std::size_t output_num = x.size();
for(std::size_t i = 0; i < output_num; ++i)
int output_num = x.size();
for(int i = 0; i < output_num; ++i)
{
verify_args(name, x[i], y[i], tolerance);
}
......@@ -136,7 +136,7 @@ void verify_reduced_program(const program& p,
{
const auto* mm = p.get_main_module();
auto n = std::distance(mm->begin(), mm->end());
for(std::size_t i = 0; i < n; i++)
for(int i = 0; i < n; i++)
{
verify_reduced(p, i, t, options, quantize, inputs, tolerance);
}
......
......@@ -17,7 +17,7 @@ struct dynamic_loader_impl
{
}
static std::shared_ptr<dynamic_loader_impl> from_buffer(const char* image, std::size_t size)
static std::shared_ptr<dynamic_loader_impl> from_buffer(const char* image, int size)
{
auto t = std::make_shared<tmp_dir>("dloader");
auto f = t->path / "libtmp.so";
......@@ -33,7 +33,7 @@ dynamic_loader::dynamic_loader(const fs::path& p) : impl(std::make_shared<dynami
{
}
dynamic_loader::dynamic_loader(const char* image, std::size_t size)
dynamic_loader::dynamic_loader(const char* image, int size)
: impl(dynamic_loader_impl::from_buffer(image, size))
{
}
......
......@@ -24,8 +24,8 @@ void eliminate_allocation::apply(module& p) const
if(ins->name() != allocation_op)
continue;
allocs.emplace_back(ins, n);
std::size_t size = ins->get_shape().bytes();
std::size_t padding = (alignment - (size % alignment)) % alignment;
int size = ins->get_shape().bytes();
int padding = (alignment - (size % alignment)) % alignment;
n += size + padding;
}
if(n > 0)
......
......@@ -19,19 +19,19 @@ static void update_op(const instruction_ref& input, const instruction_ref& ins,
auto kdims = input->get_shape().lens().size() - 2;
auto kdims_it = pad_op.pads.begin() + 2;
std::vector<size_t> pads_l(kdims_it, kdims_it + kdims);
std::vector<size_t> pads_r(kdims_it + kdims + 2, pad_op.pads.end());
std::vector<int> pads_l(kdims_it, kdims_it + kdims);
std::vector<int> pads_r(kdims_it + kdims + 2, pad_op.pads.end());
auto op = ins->get_operator();
std::vector<size_t> padding(kdims * 2, 0);
std::vector<int> padding(kdims * 2, 0);
std::transform(
pads_l.begin(), pads_l.end(), padding.begin(), padding.begin(), std::plus<size_t>());
pads_l.begin(), pads_l.end(), padding.begin(), padding.begin(), std::plus<int>());
std::transform(pads_r.begin(),
pads_r.end(),
padding.begin() + kdims,
padding.begin() + kdims,
std::plus<size_t>());
std::plus<int>());
op.from_value({{"padding", padding}});
......@@ -53,16 +53,16 @@ static void update_pooling(const instruction_ref& input, const instruction_ref&
auto kdims = input->get_shape().lens().size() - 2;
auto kdims_it = pad_op.pads.begin() + 2;
std::vector<size_t> pads_l(kdims_it, kdims_it + kdims);
std::vector<size_t> pads_r(kdims_it + kdims + 2, pad_op.pads.end());
std::vector<int> pads_l(kdims_it, kdims_it + kdims);
std::vector<int> pads_r(kdims_it + kdims + 2, pad_op.pads.end());
std::transform(
pads_l.begin(), pads_l.end(), op.padding.begin(), op.padding.begin(), std::plus<size_t>());
pads_l.begin(), pads_l.end(), op.padding.begin(), op.padding.begin(), std::plus<int>());
std::transform(pads_r.begin(),
pads_r.end(),
op.padding.begin() + kdims,
op.padding.begin() + kdims,
std::plus<size_t>());
std::plus<int>());
std::vector<instruction_ref> new_inputs{ins->inputs()};
new_inputs.front() = input->inputs().front();
......
......@@ -21,7 +21,7 @@ bool disabled(const char* name)
return contains({"0", "disable", "disabled", "no", "false"}, e.front());
}
std::size_t value_of(const char* name, std::size_t fallback)
int value_of(const char* name, int fallback)
{
auto e = env(name);
if(e.empty())
......
......@@ -31,7 +31,7 @@ std::string read_string(const std::string& filename)
return generic_read_file<std::string>(filename);
}
void write_buffer(const std::string& filename, const char* buffer, std::size_t size)
void write_buffer(const std::string& filename, const char* buffer, int size)
{
std::ofstream os(filename);
os.write(buffer, size);
......
This diff is collapsed.
......@@ -28,7 +28,7 @@ static literal get_scalar(instruction_ref ins)
static void create_pointwise_modules(module_pass_manager& mpm)
{
std::size_t n = 0;
int n = 0;
for(auto ins : iterator_for(mpm.get_module()))
{
if(not ins->get_operator().attributes().get("pointwise", false))
......@@ -39,7 +39,7 @@ static void create_pointwise_modules(module_pass_manager& mpm)
std::unordered_map<instruction_ref, instruction_ref> param_map;
std::vector<instruction_ref> pointwise_inputs;
std::size_t i = 0;
int i = 0;
for(auto input : ins->inputs())
{
if(contains(param_map, input))
......
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