MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetInputs

Method GetInputs

tensorflow/compiler/tf2tensorrt/convert/convert_nodes.cc:1716–1755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1714}
1715
1716Status Converter::GetInputs(const NodeDef& node_def,
1717 std::vector<TRT_TensorOrWeights>* inputs) const {
1718 for (auto const& input_name : node_def.input()) {
1719 /*************************************************************************
1720 * TODO(jie): handle case 1) here.
1721 * Normalizes the inputs and extracts associated metadata:
1722 * 1) Inputs can contain a colon followed by a suffix of characters.
1723 * That suffix may be a single number (e.g. inputName:1) or several
1724 * word characters separated from a number by a colon
1725 * (e.g. inputName:foo:1). The
1726 * latter case is used to denote inputs and outputs of functions.
1727 * 2) Control dependency inputs contain caret at the beginning and we
1728 * remove this and annotate the edge as a control dependency.
1729 ************************************************************************/
1730 // skip control nodes
1731 if (input_name[0] == '^') continue;
1732 string name = input_name;
1733 auto last = name.find_last_of(':');
1734 // TODO(aaroey): use TensorId
1735 if (last != string::npos && last + 2 == name.size() &&
1736 name[last + 1] == '0') {
1737 name.erase(last);
1738 }
1739
1740 if (trt_tensors_.count(name)) {
1741 TRT_TensorOrWeights input = trt_tensors_.at(name);
1742 inputs->push_back(input);
1743 VLOG(2) << "Retrieved input " << name << ": " << input.DebugString();
1744 } else {
1745 // TODO(aaroey): this should not happen, make it a CHECK.
1746 // TODO(aaroey): use StrCat for pattern like this.
1747 string msg("Node ");
1748 StrAppend(&msg, node_def.name(), " should have an input named '", name,
1749 "' but it is not available");
1750 LOG(ERROR) << msg;
1751 return errors::InvalidArgument(msg);
1752 }
1753 }
1754 return Status::OK();
1755}
1756
1757// Checks that the number of inputs match, and enforces that the inputs marked
1758// as true are constant weights. true means that the input must be a weight,

Callers 1

ConvertNodeMethod · 0.95

Calls 10

InvalidArgumentFunction · 0.85
nameMethod · 0.65
StrAppendFunction · 0.50
inputMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45
countMethod · 0.45
atMethod · 0.45
push_backMethod · 0.45
DebugStringMethod · 0.45

Tested by

no test coverage detected