Commit 0714d98e authored by Shucai Xiao's avatar Shucai Xiao
Browse files

fix build errors related to migraphx.hpp

parent 3272b22e
...@@ -385,25 +385,25 @@ extern "C" migraphx_status migraphx_shape_destroy(migraphx_shape_t shape) ...@@ -385,25 +385,25 @@ extern "C" migraphx_status migraphx_shape_destroy(migraphx_shape_t shape)
extern "C" migraphx_status migraphx_shape_create(migraphx_shape_t* shape, extern "C" migraphx_status migraphx_shape_create(migraphx_shape_t* shape,
migraphx_shape_datatype_t type, migraphx_shape_datatype_t type,
size_t* lengths, int* lengths,
int lengths_size) size_t lengths_size)
{ {
auto api_error_result = migraphx::try_([&] { auto api_error_result = migraphx::try_([&] {
if(lengths == nullptr and lengths_size != 0) if(lengths == nullptr and lengths_size != 0)
MIGRAPHX_THROW(migraphx_status_bad_param, "Bad parameter lengths: Null pointer"); MIGRAPHX_THROW(migraphx_status_bad_param, "Bad parameter lengths: Null pointer");
*shape = object_cast<migraphx_shape_t>( *shape = object_cast<migraphx_shape_t>(
allocate<migraphx::shape>((migraphx::to_shape_type(type)), allocate<migraphx::shape>((migraphx::to_shape_type(type)),
(std::vector<size_t>(lengths, lengths + lengths_size)))); (std::vector<int>(lengths, lengths + lengths_size))));
}); });
return api_error_result; return api_error_result;
} }
extern "C" migraphx_status migraphx_shape_create_with_strides(migraphx_shape_t* shape, extern "C" migraphx_status migraphx_shape_create_with_strides(migraphx_shape_t* shape,
migraphx_shape_datatype_t type, migraphx_shape_datatype_t type,
size_t* lengths, int* lengths,
int lengths_size, size_t lengths_size,
size_t* strides, int* strides,
int strides_size) size_t strides_size)
{ {
auto api_error_result = migraphx::try_([&] { auto api_error_result = migraphx::try_([&] {
if(lengths == nullptr and lengths_size != 0) if(lengths == nullptr and lengths_size != 0)
...@@ -412,8 +412,8 @@ extern "C" migraphx_status migraphx_shape_create_with_strides(migraphx_shape_t* ...@@ -412,8 +412,8 @@ extern "C" migraphx_status migraphx_shape_create_with_strides(migraphx_shape_t*
MIGRAPHX_THROW(migraphx_status_bad_param, "Bad parameter strides: Null pointer"); MIGRAPHX_THROW(migraphx_status_bad_param, "Bad parameter strides: Null pointer");
*shape = object_cast<migraphx_shape_t>( *shape = object_cast<migraphx_shape_t>(
allocate<migraphx::shape>((migraphx::to_shape_type(type)), allocate<migraphx::shape>((migraphx::to_shape_type(type)),
(std::vector<size_t>(lengths, lengths + lengths_size)), (std::vector<int>(lengths, lengths + lengths_size)),
(std::vector<size_t>(strides, strides + strides_size)))); (std::vector<int>(strides, strides + strides_size))));
}); });
return api_error_result; return api_error_result;
} }
...@@ -899,7 +899,7 @@ extern "C" migraphx_status migraphx_onnx_options_create(migraphx_onnx_options_t* ...@@ -899,7 +899,7 @@ extern "C" migraphx_status migraphx_onnx_options_create(migraphx_onnx_options_t*
} }
extern "C" migraphx_status migraphx_onnx_options_set_input_parameter_shape( extern "C" migraphx_status migraphx_onnx_options_set_input_parameter_shape(
migraphx_onnx_options_t onnx_options, const char* name, size_t* dims, int dims_size) migraphx_onnx_options_t onnx_options, const char* name, int* dims, size_t dims_size)
{ {
auto api_error_result = migraphx::try_([&] { auto api_error_result = migraphx::try_([&] {
if(onnx_options == nullptr) if(onnx_options == nullptr)
......
...@@ -93,15 +93,15 @@ migraphx_status migraphx_shape_destroy(migraphx_shape_t shape); ...@@ -93,15 +93,15 @@ migraphx_status migraphx_shape_destroy(migraphx_shape_t shape);
migraphx_status migraphx_shape_create(migraphx_shape_t* shape, migraphx_status migraphx_shape_create(migraphx_shape_t* shape,
migraphx_shape_datatype_t type, migraphx_shape_datatype_t type,
size_t* lengths, int* lengths,
int lengths_size); size_t lengths_size);
migraphx_status migraphx_shape_create_with_strides(migraphx_shape_t* shape, migraphx_status migraphx_shape_create_with_strides(migraphx_shape_t* shape,
migraphx_shape_datatype_t type, migraphx_shape_datatype_t type,
size_t* lengths, int* lengths,
int lengths_size, size_t lengths_size,
size_t* strides, int* strides,
int strides_size); size_t strides_size);
migraphx_status migraphx_shape_create_scalar(migraphx_shape_t* shape, migraphx_status migraphx_shape_create_scalar(migraphx_shape_t* shape,
migraphx_shape_datatype_t type); migraphx_shape_datatype_t type);
...@@ -225,7 +225,7 @@ migraphx_status migraphx_onnx_options_destroy(migraphx_onnx_options_t onnx_optio ...@@ -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_create(migraphx_onnx_options_t* onnx_options);
migraphx_status migraphx_onnx_options_set_input_parameter_shape( migraphx_status migraphx_onnx_options_set_input_parameter_shape(
migraphx_onnx_options_t onnx_options, const char* name, size_t* dims, int dims_size); migraphx_onnx_options_t onnx_options, const char* name, int* dims, size_t dims_size);
migraphx_status migraphx_onnx_options_set_default_dim_value(migraphx_onnx_options_t onnx_options, migraphx_status migraphx_onnx_options_set_default_dim_value(migraphx_onnx_options_t onnx_options,
size_t value); size_t value);
......
...@@ -240,9 +240,9 @@ struct shape : MIGRAPHX_CONST_HANDLE_BASE(shape) ...@@ -240,9 +240,9 @@ struct shape : MIGRAPHX_CONST_HANDLE_BASE(shape)
this->make_handle(&migraphx_shape_create_with_strides, this->make_handle(&migraphx_shape_create_with_strides,
type, type,
plengths.data(), plengths.data(),
plengths.size(), static_cast<int>(plengths.size()),
pstrides.data(), pstrides.data(),
pstrides.size()); static_cast<int>(pstrides.size()));
} }
std::vector<int> lengths() const std::vector<int> lengths() const
...@@ -268,9 +268,9 @@ struct shape : MIGRAPHX_CONST_HANDLE_BASE(shape) ...@@ -268,9 +268,9 @@ struct shape : MIGRAPHX_CONST_HANDLE_BASE(shape)
return pout; return pout;
} }
int bytes() const size_t bytes() const
{ {
int pout; size_t pout;
call(&migraphx_shape_bytes, &pout, this->get_handle_ptr()); call(&migraphx_shape_bytes, &pout, this->get_handle_ptr());
return pout; return pout;
} }
...@@ -364,9 +364,9 @@ struct program_parameter_shapes : MIGRAPHX_HANDLE_BASE(program_parameter_shapes) ...@@ -364,9 +364,9 @@ struct program_parameter_shapes : MIGRAPHX_HANDLE_BASE(program_parameter_shapes)
this->set_handle(p, borrow{}); this->set_handle(p, borrow{});
} }
int size() const size_t size() const
{ {
int pout; size_t pout;
call(&migraphx_program_parameter_shapes_size, &pout, this->get_handle_ptr()); call(&migraphx_program_parameter_shapes_size, &pout, this->get_handle_ptr());
return pout; return pout;
} }
...@@ -424,9 +424,9 @@ struct arguments : MIGRAPHX_HANDLE_BASE(arguments), array_base<arguments> ...@@ -424,9 +424,9 @@ struct arguments : MIGRAPHX_HANDLE_BASE(arguments), array_base<arguments>
arguments(migraphx_arguments* p, borrow) { this->set_handle(p, borrow{}); } arguments(migraphx_arguments* p, borrow) { this->set_handle(p, borrow{}); }
int size() const size_t size() const
{ {
int pout; size_t pout;
call(&migraphx_arguments_size, &pout, this->get_handle_ptr()); call(&migraphx_arguments_size, &pout, this->get_handle_ptr());
return pout; return pout;
} }
...@@ -457,9 +457,9 @@ struct shapes : MIGRAPHX_HANDLE_BASE(shapes), array_base<shapes> ...@@ -457,9 +457,9 @@ struct shapes : MIGRAPHX_HANDLE_BASE(shapes), array_base<shapes>
shapes(migraphx_shapes* p, borrow) { this->set_handle(p, borrow{}); } shapes(migraphx_shapes* p, borrow) { this->set_handle(p, borrow{}); }
int size() const size_t size() const
{ {
int pout; size_t pout;
call(&migraphx_shapes_size, &pout, this->get_handle_ptr()); call(&migraphx_shapes_size, &pout, this->get_handle_ptr());
return pout; return pout;
} }
......
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