Bugfixes: dangling pointers and python property typo (#17285)

### Description
Bug fixes


### Motivation and Context
Fixing one dangling pointer, and one python property name typo
This commit is contained in:
Chen Fu 2023-08-29 12:50:15 -07:00 committed by GitHub
parent fffefb1c22
commit 8827363fd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -254,13 +254,14 @@ dequantize(const Cli& cli)
out.write((const char*)dstbuf.data(), std::streamsize(dstbuf.size()) * sizeof(float));
} else {
std::streambuf* buf;
std::ofstream file_output_stream;
if (cli.output_file) {
std::ofstream out(cli.output_file, std::ios::out);
if (!out) {
file_output_stream.open(cli.output_file, std::ios::out);
if (file_output_stream.fail()) {
std::cerr << "Cannot open output file " << cli.output_file << std::endl;
return -1;
}
buf = out.rdbuf();
buf = file_output_stream.rdbuf();
} else {
buf = std::cout.rdbuf();
}

View file

@ -189,7 +189,7 @@ class MatMulWeight4Quantizer:
# recursive call to take care of sub-graph
graph_stack.append(attr.g)
kv = {attr.name: self._process_subgraph(graph_stack)}
elif attr.type == onnx.AttributeProto.GRAPH:
elif attr.type == onnx.AttributeProto.GRAPHS:
value = []
for subgraph in attr.graphs:
# recursive call to take care of sub-graph