Fix importing none inputs (#217)
This commit is contained in:
parent
d235f248e4
commit
0df421f7ad
|
@ -309,7 +309,13 @@ private:
|
|||
int expectedNumOperands = T::getNumberOfOperands();
|
||||
int expectedNumResults = T::getNumberOfResults();
|
||||
for (const auto &item : node.input())
|
||||
if (initializedTensors.ContainKey(legalize_name(item))) {
|
||||
if (item.empty()) {
|
||||
// Optional inputs using empty string will be imported as NoneType.
|
||||
if (!none_)
|
||||
none_ = builder_.create<mlir::ConstantOp>(
|
||||
UnknownLoc(), builder_.getUnitAttr());
|
||||
inputs.emplace_back(none_);
|
||||
} else if (initializedTensors.ContainKey(legalize_name(item))) {
|
||||
inputs.push_back(initializedTensors.EmitInitializerForInputTensor(
|
||||
UnknownLoc(), builder_, legalize_name(item)));
|
||||
} else if (frontend_symbols_.ContainKey(legalize_name(item))) {
|
||||
|
|
Loading…
Reference in New Issue