mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Missing autorelease in lstm_mps caused a ton of leaked memory (#145503)
The dictionary held onto the new MPSGraphTensorData objects and MPSNDArrays. Regression caused by https://github.com/pytorch/pytorch/pull/95137 Fixes #145374 Pull Request resolved: https://github.com/pytorch/pytorch/pull/145503 Approved by: https://github.com/Skylion007, https://github.com/malfet
This commit is contained in:
parent
41b38f755c
commit
2f317bbdbc
|
|
@ -322,13 +322,13 @@ std::tuple<Tensor, Tensor, Tensor, Tensor, Tensor, Tensor> _lstm_mps(const Tenso
|
|||
Placeholder outputPlaceholder3 = Placeholder(cachedGraph->outputTensors_[3], zState);
|
||||
Placeholder outputPlaceholder4 = Placeholder(cachedGraph->outputTensors_[4], cellStateFwd);
|
||||
|
||||
NSMutableDictionary<MPSGraphTensor*, MPSGraphTensorData*>* results = [@{
|
||||
NSMutableDictionary<MPSGraphTensor*, MPSGraphTensorData*>* results = [[@{
|
||||
outputPlaceholder0.getMPSGraphTensor() : outputPlaceholder0.getMPSGraphTensorData(),
|
||||
outputPlaceholder1.getMPSGraphTensor() : outputPlaceholder1.getMPSGraphTensorData(),
|
||||
outputPlaceholder2.getMPSGraphTensor() : outputPlaceholder2.getMPSGraphTensorData(),
|
||||
outputPlaceholder3.getMPSGraphTensor() : outputPlaceholder3.getMPSGraphTensorData(),
|
||||
outputPlaceholder4.getMPSGraphTensor() : outputPlaceholder4.getMPSGraphTensorData(),
|
||||
} mutableCopy];
|
||||
} mutableCopy] autorelease];
|
||||
|
||||
if (num_layers > 1) {
|
||||
Placeholder outputPlaceholder5 = Placeholder(cachedGraph->outputTensors_[5], layerOutputs);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user