-
Notifications
You must be signed in to change notification settings - Fork 66
Add graph.duplicate()
utility
#2298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
❌ 4 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
for node in self: | ||
# Map old inputs to new inputs using value_map | ||
new_inputs = [ | ||
value_map.get(val) if val is not None else None # type: ignore[misc] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle nested graphs as well?
doc_string=init.doc_string, | ||
const_value=init.const_value, | ||
) | ||
value_map[init] = new_init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An initializer may also be an input. Will this create duplicates in this case?
self.assertEqual(orig_node.name, dup_node.name) | ||
self.assertEqual(len(orig_node.inputs), len(dup_node.inputs)) | ||
self.assertEqual(len(orig_node.outputs), len(dup_node.outputs)) | ||
self.assertNotEqual(id(orig_node), id(dup_node)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.assertNotEqual(id(orig_node), id(dup_node)) | |
self.assertIsNot(orig_node, dup_node) |
self.assertEqual(orig_val.name, dup_val.name) | ||
self.assertEqual(orig_val.shape, dup_val.shape) | ||
self.assertEqual(orig_val.type, dup_val.type) | ||
self.assertNotEqual(id(orig_val), id(dup_val)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.assertNotEqual(id(orig_val), id(dup_val)) | |
self.assertIsNot(orig_val, dup_val) |
No description provided.