| 726 | } |
| 727 | |
| 728 | std::vector<shape> module::get_output_shapes() const |
| 729 | { |
| 730 | if(impl->instructions.empty()) |
| 731 | return {}; |
| 732 | auto last_ins = impl->instructions.back(); |
| 733 | if(last_ins.name() == "@return") |
| 734 | { |
| 735 | const auto& output_ins = last_ins.inputs(); |
| 736 | std::vector<shape> output_shapes; |
| 737 | std::transform(output_ins.begin(), |
| 738 | output_ins.end(), |
| 739 | std::back_inserter(output_shapes), |
| 740 | [](auto& ins) { return ins->get_shape(); }); |
| 741 | |
| 742 | return output_shapes; |
| 743 | } |
| 744 | // The else branch is to provide backward compatibility |
| 745 | else |
| 746 | { |
| 747 | return {last_ins.get_shape()}; |
| 748 | } |
| 749 | } |
| 750 | |
| 751 | std::vector<shape> module::compute_shapes(const std::vector<shape>& inputs, |
| 752 | compute_shapes_options options) const |