MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / Dimshuffle

Method Dimshuffle

src/opr/impl/tensor_manip.cpp:486–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484MGB_DYN_TYPE_OBJ_FINAL_IMPL(Dimshuffle);
485
486Dimshuffle::Dimshuffle(
487 VarNode* inp, const std::vector<int>& pattern, size_t ndim,
488 const OperatorNodeConfig& config)
489 : Super{inp->owner_graph(), config, "dimshuffle", {inp}},
490 m_pattern(pattern),
491 m_inp_ndim(ndim) {
492 mgb_throw_if(
493 m_pattern.size() > TensorShape::MAX_NDIM, GraphError,
494 "Dimshuffle pattern exceeds max length of %zd", TensorShape::MAX_NDIM);
495 for (auto i : m_pattern) {
496 mgb_throw_if(i < -1 || i >= int(ndim), GraphError, "bad Dimshuffle pattern");
497 }
498 axis_manip_init(inp);
499 add_equivalence_component<PODHash<int>>(m_pattern.data(), m_pattern.size());
500}
501
502SymbolVar Dimshuffle::make(
503 SymbolVar inp, const std::vector<int>& pattern, size_t ndim,

Callers 3

diag_plane_subgraphFunction · 0.80
einsumFunction · 0.80
transposeFunction · 0.80

Calls 3

owner_graphMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by 1

transposeFunction · 0.64