code: def test_custom_loss_does_not_call_sigmoid(
      self, net_cls, data, module_cls, monkeypatch
  ):
      mock = Mock(side_effect=lambda x: x)
      monkeypatch.setattr(torch, "sigmoid", mock)
  
      # add a custom nonlinearity - note that the output must return
      # a 2d array from a 1d vector to conform to the required
      # y_proba
      def nonlin(x):
          return torch.stack((1 - x, x), 1)
  
      net = net_cls(
          module_cls,
          max_epochs=1,
          lr=0.1,
          criterion=nn.MSELoss,
          predict_nonlinearity=nonlin,
      )
      X, y = data
      net.fit(X, y)
  
      net.predict_proba(X)
      assert mock.call_count == 0
  
imports: from unittest.mock import Mock
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from sklearn.base import clone
  from torch import nn
  from skorch.tests.conftest import INFERENCE_METHODS
label_desc: Use image node_id 16 for calling the TestNeuralNetBinaryClassifier obj's underlying member method code with example usage: obj.test_custom_loss_does_not_call_sigmoid(net_cls, data, module_cls, monkeypatch) and returns: torch