docs: def apply_network(network, x, chunksize=None):
      """
      Apply a pytorch network, potentially in chunks
      """
      network_is_cuda = next(network.parameters()).is_cuda
  
      x = torch.from_numpy(x)
  
      with torch.no_grad():
          if network_is_cuda:
              x = x.cuda()
  
          if chunksize is None:
              return from_var(network(x))
  
          return np.concatenate(
              [from_var(network(x[i: i + chunksize]))
               for i in range(0, len(x), chunksize)])