code: def _infer_predict_nonlinearity(net):
      """Infers the correct nonlinearity to apply for this net
  
      The nonlinearity is applied only when calling
      :func:`~skorch.classifier.NeuralNetClassifier.predict` or
      :func:`~skorch.classifier.NeuralNetClassifier.predict_proba`.
  
      """
      # Implementation: At the moment, this function "dispatches" only
      # based on the criterion, not the class of the net. We still pass
      # the whole net as input in case we want to modify this at a
      # future point in time.
      if len(net._criteria) != 1:
          # don't know which criterion to consider, don't try to guess
          return _identity
  
      criterion = getattr(net, net._criteria[0] + "_")
  
      if isinstance(criterion, CrossEntropyLoss):
          return partial(torch.softmax, dim=-1)
  
      if isinstance(criterion, BCEWithLogitsLoss):
          return _sigmoid_then_2d
  
      if isinstance(criterion, BCELoss):
          return _make_2d_probs
  
      return _identity
  
imports: from collections.abc import Mapping, Sequence
  from contextlib import contextmanager
  from enum import Enum
  from functools import partial
  import io
  from itertools import tee
  import pathlib
  import warnings
  import numpy
  from scipy import sparse
  import sklearn
  from sklearn.exceptions import NotFittedError
  from sklearn.utils import _safe_indexing
  from sklearn.utils.validation import check_is_fitted
  import torch
  from torch.nn import BCELoss
  from torch.nn import BCEWithLogitsLoss
  from torch.nn import CrossEntropyLoss
  from torch.nn.utils.rnn import PackedSequence
  from torch.utils.data.dataset import Subset
  from skorch.exceptions import DeviceWarning
  from skorch.exceptions import NotInitializedError
label_desc: Use image node_id 35 for calling a global function with example usage: _infer_predict_nonlinearity(net) and returns: _identity, _identity, partial, _sigmoid_then_2d, _make_2d_probs