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

Method compute_shape

src/targets/cpu/binary.cpp:44–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 std::string name() const { return "dnnl::binary"; }
43
44 shape compute_shape(std::vector<shape> inputs) const
45 {
46 // Compensate for allocation
47 inputs.pop_back();
48 check_shapes{this->trim_post_op_inputs(inputs), *this}.has(2);
49 auto s0 = inputs.at(0);
50 auto s1 = inputs.at(1);
51 auto r = s0;
52 if(s0 != s1 or not s0.packed())
53 {
54 if(s0.packed() != s1.packed())
55 {
56 r = s0.packed() ? s0 : s1;
57 }
58 else if(s0.broadcasted() != s1.broadcasted())
59 {
60 r = s0.broadcasted() ? s1.with_lens(s0.lens()) : s0.with_lens(s0.lens());
61 }
62 else
63 {
64 r = {s0.type(), s0.lens()};
65 }
66 }
67 // Call to get_primitive to make sure an algo is available
68 this->get_primitive(this->to_memory_desc(r, inputs));
69 return r;
70 }
71
72 dnnl::binary::desc get_desc(const std::unordered_map<int, dnnl::memory::desc>& m) const
73 {

Callers

nothing calls this directly

Calls 10

hasMethod · 0.80
trim_post_op_inputsMethod · 0.80
atMethod · 0.80
with_lensMethod · 0.80
lensMethod · 0.80
get_primitiveMethod · 0.80
to_memory_descMethod · 0.80
packedMethod · 0.45
broadcastedMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected