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

Method apply

python/paddle/base/framework.py:2129–2137  ·  view source on GitHub ↗
(self, func)

Source from the content-addressed store, hash-verified

2127 )
2128
2129 def apply(self, func):
2130 if not self.stop_gradient:
2131 raise RuntimeError(
2132 "Cannot apply function on a tensor that required gradient."
2133 )
2134 try:
2135 return func(self)
2136 except:
2137 raise ValueError(f"The PyFunc {func.__name__} could not be applied")
2138
2139 def __str__(self):
2140 return self._to_readable_code()

Callers 3

compileMethod · 0.45
drawMethod · 0.45
to_programMethod · 0.45

Calls 3

RuntimeErrorClass · 0.85
ValueErrorClass · 0.85
funcFunction · 0.50

Tested by

no test coverage detected