MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __pow__

Method __pow__

machine_learning/automatic_differentiation.py:110–122  ·  view source on GitHub ↗
(self, power: int)

Source from the content-addressed store, hash-verified

108 return result
109
110 def __pow__(self, power: int) -> Variable:
111 result = Variable(self.value**power)
112
113 with GradientTracker() as tracker:
114 # if tracker is enabled, computation graph will be updated
115 if tracker.enabled:
116 tracker.append(
117 OpType.POWER,
118 params=[self],
119 output=result,
120 other_params={"power": power},
121 )
122 return result
123
124 def add_param_to(self, param_to: Operation) -> None:
125 self.param_to.append(param_to)

Callers

nothing calls this directly

Calls 3

VariableClass · 0.85
GradientTrackerClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected