code: def test_no_grad(self, mode):
      with autograd_fallback_mode(mode):
          lib = self.get_lib()
          lib.define("foo(Tensor a, Tensor b, int c) -> Tensor")
          lib.impl("foo", lambda a, b, c: a + b + c, "CPU")
          op = self.get_op("foo")
  
          with warnings.catch_warnings():
              warnings.simplefilter("error")
              with torch.no_grad():
                  a = torch.randn([], requires_grad=True)
                  b = torch.randn([], requires_grad=True)
                  out = op(a, b, 1)
              self.assertFalse(out.requires_grad)
  
          with warnings.catch_warnings():
              warnings.simplefilter("error")
              a = torch.randn([])
              b = torch.randn([])
              out = op(a, b, 1)
              self.assertFalse(out.requires_grad)
  
imports: import contextlib
  import warnings
  import numpy
  import torch
  from torch.library import Library
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, TestCase
label_desc: Use image node_id 4 for calling the TestAutogradFallback obj's underlying member method code with example usage: obj.test_no_grad(mode) without return types