class_docstr: This class tests all autograd-related functionality.
docstr: Tests that requires_grad influences tracking of forward computations.
docstr_tok: ["Tests","that","requires_grad","influences","tracking","of","forward","computations","."]
code: def test_forward_tracking(self):
      """Tests that requires_grad influences tracking of forward computations."""
  
      for requires_grad in [True, False]:
          # get test case:
          input = get_random_test_tensor(size=(12, 5), is_float=True)
          input = crypten.cryptensor(input, requires_grad=requires_grad)
  
          # perform forward computation:
          output = input.exp().sum()
  
          # setting requires_grad post-hoc should not affect backward behavior:
          input.requires_grad = True
          output.requires_grad = True
          output.backward()
  
          # check results:
          msg = "tracking of forward computations does not work as expected"
          if requires_grad:
              self.assertIsNotNone(input.grad, msg)
              self.assertIsNone(output.grad, msg)
          else:
              self.assertIsNone(input.grad, msg)
              self.assertIsNotNone(output.grad, msg)
  
imports: import logging
  import random
  import unittest
  import crypten
  import crypten.gradients
  import torch
  from crypten.common.tensor_types import is_float_tensor
  from crypten.config import cfg
  from crypten.gradients import AutogradContext, AutogradFunction
  from test.multiprocess_test_case import get_random_test_tensor, MultiProcessTestCase
label_desc: Use image node_id 8 for calling the TestAutograd obj's underlying member method code with example usage: obj.test_forward_tracking() without return types