Open ghost opened 1 year ago
Yes, in theory. But there could be some other computations book-kept somewhere. Without seeing the code, hard for me to tell. You can insert https://liuliu.github.io/s4nnc/documentation/nnc/dynamicgraph/statistics-swift.property to see whether you have computations / tensors recorded in between (graph.statistics
). It also could be a bug that some variables we should be able to garbage collect but fail to.
Thanks, ill take a look
run now in the txt2img example you have one big graph.withNoGrad and the for loop is inside it.
rather than that, if i have one graph.withNoGrad for text model stuff , and one graph.withNoGrad for each iteration, ie. if i have graph.withNoGrad inside the for loop. Than it increases the memory usage from 3GB to 4.2GB/
what could be the reason? all the .run etc are still inside graph.withNoGrad , just different graph.withNoGrad