Commit ae1cb853 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

Merge branch 'op_capture' into int8_quantize

parents 2d33413c 36ab4520
...@@ -19,7 +19,7 @@ namespace op { ...@@ -19,7 +19,7 @@ namespace op {
struct capture struct capture
{ {
std::size_t ins_index; std::size_t ins_index;
std::function<void(std::size_t ins_index, std::vector<argument>)> f; std::function<void(std::size_t ins_index, std::vector<argument>)> f{};
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
...@@ -31,8 +31,16 @@ struct capture ...@@ -31,8 +31,16 @@ struct capture
shape compute_shape(std::vector<shape> inputs) const { return inputs.front(); } shape compute_shape(std::vector<shape> inputs) const { return inputs.front(); }
argument compute(const shape&, std::vector<argument> args) const argument compute(const shape&, std::vector<argument> args) const
{
if(f)
{ {
f(ins_index, args); f(ins_index, args);
}
else
{
MIGRAPHX_THROW("CAPTURE: callback function is not callable!");
}
return args.front(); return args.front();
} }
}; };
......
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