(self, gradient=None, retain_graph=False, create_graph=False)
| 30 | |
| 31 | |
| 32 | def _backward(self, gradient=None, retain_graph=False, create_graph=False): |
| 33 | if lazy_mode.is_enabled(): |
| 34 | assert ( |
| 35 | self.is_lazy |
| 36 | ), "nn.Graph only accept lazy tensor to call backward() in lazy mode." |
| 37 | assert ( |
| 38 | not retain_graph |
| 39 | ), "nn.Graph donot accept 'retain_graph' argument in backward() at the moment." |
| 40 | assert ( |
| 41 | not create_graph |
| 42 | ), "nn.Graph donot accept 'create_graph' argument in backward() at the moment." |
| 43 | flow._oneflow_internal.nn.graph.AddTensorAsGraphLoss(self) |
| 44 | flow.autograd.backward(self, gradient, retain_graph, create_graph) |
| 45 | |
| 46 | |
| 47 | def _str(self): |
nothing calls this directly
no test coverage detected