def test_recompute_offload(self):
    (train_prog, startup_prog) = (fluid.Program(), fluid.Program())
    (avg_cost, strategy) = self.net(train_prog, startup_prog)
    self.set_strategy(strategy, 'recompute-offload')
    self.optimizer(avg_cost, strategy, train_prog, startup_prog)
    ops = [op.type for op in avg_cost.block.ops]
    outs = [op.output('Out')[0] for op in avg_cost.block.ops if (op.type == 'memcpy')]
    self.assertIn('memcpy', ops)
    self.assertIn('@Pinned', ''.join(outs))
    self.assertIn('@Fetch', ''.join(outs))
def test_recompute_offload(self):
    (train_prog, startup_prog) = (fluid.Program(), fluid.Program())
    (avg_cost, strategy) = self.net(train_prog, startup_prog)
    self.set_strategy(strategy, 'recompute-offload')
    self.optimizer(avg_cost, strategy, train_prog, startup_prog)
    ops = [op.type for op in avg_cost.block.ops]
    outs = [op.output('Out')[0] for op in avg_cost.block.ops if (op.type == 'memcpy')]
    self.assertIn('memcpy', ops)
    self.assertIn('@Pinned', .join(outs))
    self.assertIn('@Fetch', .join(outs))