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: 3

Non-data size: 3

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: AIRLab-POLIMI/mushroom
Commit Name: e304d4ee794a4cca8c116e52f99077ee71f87af1
Time: 2018-09-03
Author: carloderamo@gmail.com
File Name: mushroom/approximators/parametric/pytorch_network.py
Class Name: PyTorchApproximator
Method Name: predict


Project Name: Zhaoyi-Yan/Shift-Net_pytorch
Commit Name: 2d911000d26d874b369e47d3e01dcab1dae62c5c
Time: 2018-12-12
Author: yanzhaoyi@outlook.com
File Name: models/accelerated_shift_net/accelerated_InnerShiftTripleFunction.py
Class Name: AcceleratedInnerShiftTripleFunction
Method Name: forward