code: def test_exception():
      class ExpectedException(Exception):
          pass
  
      class Raise(nn.Module):
          def forward(self, *_):
              raise ExpectedException()
  
      model = nn.Sequential(Raise())
      model = Pipe(model, balance=[1], devices=["cpu"], chunks=1)
  
      with pytest.raises(ExpectedException):
          model(torch.rand(1))
  
imports: from collections import OrderedDict
  from copy import deepcopy
  import time
  import pytest
  import torch
  from torch import nn
  from fairscale.nn.pipe import Pipe
label_desc: Use image node_id 16 for calling a global function with example usage: test_exception() without return types