8e12624641eab7a7e73497ea96124bb39aca1c01,memcnn/models/revop.py,InvertibleCheckpointFunction,forward,#Any#Any#Any#Any#Any#Any#,13

Before Change


        ctx.num_bwd_passes = num_bwd_passes

        with torch.no_grad():
            x = input_t.detach()  // Makes a detached copy which shares the storage
            output = ctx.fn(x)

        detached_output = output.detach_()  // Detaches y in-place (inbetween computations can now be discarded)

After Change


        ctx.num_bwd_passes = num_bwd_passes
        ctx.num_inputs = num_inputs

        input_t = inputs_and_weights[:num_inputs]
        ctx.input_requires_grad = [element.requires_grad for element in input_t]

        with torch.no_grad():
            // Makes a detached copy which shares the storage
            x = [element.detach() for element in input_t]
            output = ctx.fn(*x)


        if not isinstance(output, tuple):
            output = (output,)

        // Detaches y in-place (inbetween computations can now be discarded)
        detached_output = tuple([element.detach_() for element in output])

        // store these tensor nodes for backward pass
        ctx.input_t = [input_t] * num_bwd_passes
        ctx.output_t = [detached_output] * num_bwd_passes
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: silvandeleemput/memcnn
Commit Name: 8e12624641eab7a7e73497ea96124bb39aca1c01
Time: 2020-03-04
Author: ce377@orthosie.damtp.cam.ac.uk
File Name: memcnn/models/revop.py
Class Name: InvertibleCheckpointFunction
Method Name: forward


Project Name: facebookresearch/Horizon
Commit Name: 69061e67d62a067c2a8a5c6a440f7b9605c111d6
Time: 2020-08-28
Author: badri@fb.com
File Name: reagent/training/reinforce.py
Class Name: Reinforce
Method Name: train


Project Name: catalyst-team/catalyst
Commit Name: f93beff338925cc1bf1b3ff1b32a2c440a4c9427
Time: 2020-04-21
Author: scitator@gmail.com
File Name: tests/_tests_scripts/z_mvp_mnist_gan.py
Class Name: CustomRunner
Method Name: _handle_batch