MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / _save

Method _save

python/paddle/hapi/model.py:392–404  ·  view source on GitHub ↗
(state, path)

Source from the content-addressed store, hash-verified

390
391 def save(self, path):
392 def _save(state, path):
393 if not state:
394 return
395 state = {
396 k: (
397 to_numpy(v)
398 if isinstance(v, paddle.base.libpaddle.pir.Value)
399 else v
400 )
401 for k, v in state.items()
402 }
403 with open(path, 'wb') as f:
404 pickle.dump(state, f)
405
406 def get_tensor(var):
407 t = global_scope().find_var(var.name).get_tensor()

Callers

nothing calls this directly

Calls 3

dumpMethod · 0.80
to_numpyFunction · 0.70
itemsMethod · 0.45

Tested by

no test coverage detected