MCPcopy Index your code
hub / github.com/pytorch/pytorch / testUseOutput

Method testUseOutput

caffe2/python/core_gradients_test.py:189–208  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

187 pass
188
189 def testUseOutput(self):
190 operators = [
191 CreateOperator('UseOutput', 'in', 'hidden'),
192 CreateOperator('UseOutput', 'hidden', 'out'),
193 CreateOperator('Direct', 'out', 'sink'),
194 ]
195 desired_grad_operators = [
196 CreateOperator('DirectGradient', 'sink_grad', 'out_grad'),
197 CreateOperator(
198 'UseOutputGradient',
199 ['out', 'out_grad'], 'hidden_grad'
200 ),
201 CreateOperator(
202 'UseOutputGradient',
203 ['hidden', 'hidden_grad'], 'in_grad'
204 ),
205 ]
206 gradients, _ = GradientRegistry.GetBackwardPass(
207 operators, {'sink': 'sink_grad'})
208 self.assertOperatorListEqual(gradients, desired_grad_operators)
209
210 def testUseOutputInPlace(self):
211 operators = [

Callers

nothing calls this directly

Calls 3

CreateOperatorFunction · 0.90
GetBackwardPassMethod · 0.45

Tested by

no test coverage detected