class_docstr: This class tests all autograd-related functionality.
docstr: Tests that in-place functions cannot be used in autograd but return
  correct results outside of autograd.
docstr_tok: ["Tests","that","in-place","functions","can","not","be","used","in","autograd","but","return","correct","results","outside","of","autograd","."]
code: def test_inplace(self):
      """
      Tests that in-place functions cannot be used in autograd but return
      correct results outside of autograd.
      """
      value = 1.5
      reference = get_random_test_tensor(
          size=(1, 3, 8, 8), is_float=True
      )
      for requires_grad in [False, True]:
          result = crypten.cryptensor(
              reference, requires_grad=requires_grad
          )
          if requires_grad:
              with self.assertRaises(RuntimeError):
                  result.add_(value)
          else:
              result.add_(value)
              self._check(
                  result,
                  reference.add(value),
                  "in-place addition failed",
              )
  
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 4 for calling the TestAutograd obj's underlying member method code with example usage: obj.test_inplace() without return types