(self, power: int)
| 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) |
nothing calls this directly
no test coverage detected