If I need to copy a variable created by an operation instead of user,and let the copy have an independent memory,what can I do for that purpose?
Thank you!
How do you want to use the copy? If you need to make it a new leaf then you can do Variable(other.data.clone())
, otherwise you might just call .clone()
on the Variable (but remember that this will keep reference to all the history!)