MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / _to_memory_format

Method _to_memory_format

python/oneflow/nn/modules/module.py:1420–1440  ·  view source on GitHub ↗

r"""Casts the parameters and buffers in this module to another memory format. The data_format attribute should also be modified. Note: This interface is unstable and may be removed in the future once the data_format attribute has been removed from t

(self, memory_format)

Source from the content-addressed store, hash-verified

1418 return self._apply(lambda t: flow.empty_like(t, device=device))
1419
1420 def _to_memory_format(self, memory_format):
1421 r"""Casts the parameters and buffers in this module to another memory format.
1422
1423 The data_format attribute should also be modified.
1424
1425 Note:
1426 This interface is unstable and may be removed in the future once the data_format
1427 attribute has been removed from the module.
1428
1429 Args:
1430 memory_format (:class:`oneflow.memory_format`): the desired memory
1431 format for 4D parameters and buffers in this module (keyword
1432 only argument)
1433
1434 Returns:
1435 Module: self
1436 """
1437 for module in self.children():
1438 module._to_memory_format(memory_format)
1439 self.to_memory_format(memory_format)
1440 return self
1441
1442 def to_memory_format(self, memory_format) -> None:
1443 pass

Callers 1

toMethod · 0.95

Calls 2

childrenMethod · 0.95
to_memory_formatMethod · 0.95

Tested by

no test coverage detected