MCPcopy Create free account
hub / github.com/OpenDriveLab/OccNet / inverse_sigmoid

Function inverse_sigmoid

projects/mmdet3d_plugin/bevformer/modules/decoder.py:34–49  ·  view source on GitHub ↗

Inverse function of sigmoid. Args: x (Tensor): The tensor to do the inverse. eps (float): EPS avoid numerical overflow. Defaults 1e-5. Returns: Tensor: The x has passed the inverse function of sigmoid, has same

(x, eps=1e-5)

Source from the content-addressed store, hash-verified

32def inverse_sigmoid(x, eps=1e-5):
33 """Inverse function of sigmoid.
34 Args:
35 x (Tensor): The tensor to do the
36 inverse.
37 eps (float): EPS avoid numerical
38 overflow. Defaults 1e-5.
39 Returns:
40 Tensor: The x has passed the inverse
41 function of sigmoid, has same
42 shape with input.
43 """
44 x = x.clamp(min=0, max=1)
45 x1 = x.clamp(min=eps)
46 x2 = (1 - x).clamp(min=eps)
47 return torch.log(x1 / x2)
48
49
50@TRANSFORMER_LAYER_SEQUENCE.register_module()
51class DetectionTransformerDecoder(TransformerLayerSequence):
52 """Implements the decoder in DETR3D transformer.

Callers 1

forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected