MCPcopy Create free account
hub / github.com/pytorch/pytorch / getTensorMemoryByDevice

Function getTensorMemoryByDevice

torch/utils/model_dump/code.js:536–549  ·  view source on GitHub ↗
(pickles)

Source from the content-addressed store, hash-verified

534}
535
536function getTensorMemoryByDevice(pickles) {
537 let all_tensors = [];
538 for (const [name, pickle] of pickles) {
539 const tensors = getTensorStorages(pickle);
540 all_tensors.push(...tensors.values());
541 }
542 let result = {};
543 for (const storage of all_tensors.values()) {
544 const [dtype, key, device, numel] = storage;
545 const size = computeTensorMemory(numel, dtype);
546 result[device] = (result[device] || 0) + size;
547 }
548 return result;
549}
550
551// Make this a separate component so it is rendered lazily.
552class OpenTensorMemorySection extends Component {

Callers 1

renderMethod · 0.85

Calls 4

getTensorStoragesFunction · 0.85
computeTensorMemoryFunction · 0.85
pushMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…