Unverified Commit 74fb919a authored by Charlie Lin's avatar Charlie Lin Committed by GitHub
Browse files

Fix allocate 0 arg version (#2388)

parent 22bb777f
...@@ -37,6 +37,8 @@ namespace op { ...@@ -37,6 +37,8 @@ namespace op {
* Static allocate: * Static allocate:
* No inputs: `allocate()` * No inputs: `allocate()`
* `this.s` attribute set to the static output shape of the buffer. * `this.s` attribute set to the static output shape of the buffer.
* `this.s` attribute can be set to a dynamic output shape; however this will allocate the maximum
* buffer size for that case
* *
* Dynamic allocate: * Dynamic allocate:
* One input: `allocate(output_dims)` * One input: `allocate(output_dims)`
...@@ -74,10 +76,6 @@ struct allocate ...@@ -74,10 +76,6 @@ struct allocate
} }
else else
{ {
if(s->dynamic())
{
MIGRAPHX_THROW("ALLOCATE: dynamic shape attribute and no input");
}
migraphx::check_shapes{inputs, *this, false}.has(0); migraphx::check_shapes{inputs, *this, false}.has(0);
} }
return s.value(); return s.value();
......
...@@ -116,11 +116,12 @@ TEST_CASE(allocate_dyn_with_shape_attr) ...@@ -116,11 +116,12 @@ TEST_CASE(allocate_dyn_with_shape_attr)
input); input);
} }
TEST_CASE(allocate_dyn_no_input_error) TEST_CASE(allocate_dyn_no_input)
{ {
migraphx::shape shape_attr{migraphx::shape::float_type, migraphx::shape shape_attr{migraphx::shape::float_type,
{{1, 4}, {3, 3}, {4, 8, {4, 6}}, {4, 8}, {4, 6}}}; {{1, 4}, {3, 3}, {4, 8, {4, 6}}, {4, 8}, {4, 6}}};
throws_shape(migraphx::make_op("allocate", {{"shape", migraphx::to_value(shape_attr)}})); expect_shape(shape_attr,
migraphx::make_op("allocate", {{"shape", migraphx::to_value(shape_attr)}}));
} }
TEST_CASE(allocate_shape_and_buf_type_error) TEST_CASE(allocate_shape_and_buf_type_error)
......
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