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

Method get_io_tensor

lite/src/mge/network_impl.cpp:983–1015  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

981}
982
983std::shared_ptr<Tensor> NetworkImplDft::get_io_tensor(
984 std::string io_name, LiteTensorPhase phase) {
985 if (phase == LiteTensorPhase::LITE_INPUT || phase == LiteTensorPhase::LITE_IO) {
986 for (auto&& config_in : m_network_io->inputs) {
987 if (io_name == config_in.name) {
988 if (config_in.lite_tensor) {
989 return config_in.lite_tensor;
990 } else {
991 LITE_THROW(mgb::ssprintf(
992 "%s input tensor is in discrete mode, you can use "
993 "get_discrete_tensors to get this input.",
994 io_name.c_str()));
995 return nullptr;
996 }
997 }
998 }
999 }
1000 if (phase == LiteTensorPhase::LITE_OUTPUT || phase == LiteTensorPhase::LITE_IO) {
1001 for (auto&& config_out : m_network_io->outputs) {
1002 if (io_name == config_out.name) {
1003 config_out.lite_tensor->update_from_implement();
1004 return config_out.lite_tensor;
1005 }
1006 }
1007 }
1008 LITE_THROW(mgb::ssprintf(
1009 "tensor name must be %s input tensor name or the registered "
1010 "output tensor name if NetworkIO is set, if NetworkIO is not set, "
1011 "the output tensor is all the network output tensor, or the output "
1012 "tensor is only the registered tensor.",
1013 io_name.c_str()));
1014 return nullptr;
1015}
1016
1017std::vector<std::shared_ptr<Tensor>> NetworkImplDft::get_discrete_tensors(
1018 std::string io_name, LiteTensorPhase phase) {

Callers

nothing calls this directly

Calls 1

update_from_implementMethod · 0.45

Tested by

no test coverage detected