Skip to content

Commit

Permalink
Process the case when symlink already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-savelyevv committed Oct 2, 2023
1 parent 20c5fee commit 104bf70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/ir_subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# limitations under the License.

import argparse
import os
import xml.etree.ElementTree as ET
from copy import copy
from copy import deepcopy
Expand Down Expand Up @@ -268,6 +269,9 @@ def take_model_subgraph(xml_dict, source_node_name, distance):
write_xml(subgraph_xml_dict, output_path)

# Create a symbolic link to original .bin file
output_path.with_suffix(".bin").symlink_to(input_path.with_suffix(".bin").absolute())
bin_output_path = output_path.with_suffix(".bin")
if bin_output_path.exists():
os.remove(bin_output_path)
bin_output_path.symlink_to(input_path.with_suffix(".bin").absolute())

print("Saved at:", output_path)

0 comments on commit 104bf70

Please sign in to comment.