code: def test_detach_hidden_RNN():
      # Create hidden vector (in tuple)
      X = torch.ones(2, 3, 4)
      model = nn.RNN(4, 1)
      _, hidden = model(X)
  
      # Function to test
      hidden_ = _detach_hidden(hidden)
  
      assert hidden_.grad_fn is None  # properly detached
      assert (hidden == hidden_).all().item() == 1
  
file_path: ignite/tests/ignite/contrib/engines/test_tbptt.py
imports: import unittest.mock
  import pytest
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from ignite.contrib.engines import create_supervised_tbptt_trainer, Tbptt_Events
  from ignite.contrib.engines.tbptt import _detach_hidden
label_desc: Use image node_id 1 for calling a global function with example usage: test_detach_hidden_RNN() without return types