MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / parse

Method parse

src/tf/parse_squeeze.cpp:38–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 11

lensMethod · 0.80
atMethod · 0.80
make_opFunction · 0.50
get_shapeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
add_instructionMethod · 0.45
make_contiguousMethod · 0.45

Tested by

no test coverage detected