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

Method float

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

r""" float() Casts all floating point parameters and buffers to ``float`` datatype. .. note:: This method modifies the module in-place. Returns: Module: self

(self: T)

Source from the content-addressed store, hash-verified

1632 return self._apply(lambda t: t.cuda(device))
1633
1634 def float(self: T) -> T:
1635 r"""
1636 float()
1637
1638 Casts all floating point parameters and buffers to ``float`` datatype.
1639
1640 .. note::
1641 This method modifies the module in-place.
1642
1643 Returns:
1644 Module: self
1645 """
1646 return self._apply(lambda t: t.float() if t.is_floating_point() else t)
1647
1648 def double(self: T) -> T:
1649 r"""

Calls 2

_applyMethod · 0.95
is_floating_pointMethod · 0.45