| 36 | std::vector<op_desc> operators() const { return {{"Squeeze"}}; } |
| 37 | |
| 38 | instruction_ref parse(const op_desc& /*opd*/, |
| 39 | const tf_parser& /*parser*/, |
| 40 | tf_parser::node_info info, |
| 41 | std::vector<instruction_ref> args) const |
| 42 | { |
| 43 | auto input_dims = args[0]->get_shape().lens(); |
| 44 | auto axes = info.attributes.at("squeeze_dims").list().i(); |
| 45 | std::vector<int64_t> op_axes(axes.begin(), axes.end()); |
| 46 | |
| 47 | if(op_axes.empty()) // no squeeze_dims provided, remove any dim that equals 1 |
| 48 | { |
| 49 | for(size_t i = 0; i < input_dims.size(); i++) |
| 50 | { |
| 51 | if(input_dims.at(i) == 1) |
| 52 | { |
| 53 | op_axes.push_back(i); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | return info.add_instruction(make_op("squeeze", {{"axes", op_axes}}), |
| 58 | info.make_contiguous(args[0])); |
| 59 | } |
| 60 | }; |
| 61 | |
| 62 | } // namespace tf |
nothing calls this directly
no test coverage detected