Hi ptrblck,
I’ve just implemented your solution and I get an error. I was wondering if you could take a look?
Traceback (most recent call last):
  File "main.py", line 152, in <module>
    X, _ = sampler(burn_in)
  File "~/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "~/anaconda3/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "~/src/Samplers.py", line 83, in forward
    self.step()
  File "~/anaconda3/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "~/src/Samplers.py", line 67, in step
    log_a = self._log_pdf(xcand).detach_() - self._log_pdf(self.chains).detach_()  #calculate log acceptance probability 
  File "~/anaconda3/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "~/src/Samplers.py", line 47, in _log_pdf
    return torch.slogdet(self.network(x)[0])[1].mul(2).detach_()
  File "~/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
RuntimeError: nvrtc: error: failed to open libnvrtc-builtins.so.11.1.
  Make sure that libnvrtc-builtins.so.11.1 is installed correctly.
nvrtc compilation failed: 

#define NAN __int_as_float(0x7fffffff)
#define POS_INFINITY __int_as_float(0x7f800000)
#define NEG_INFINITY __int_as_float(0xff800000)


template<typename T>
__device__ T maximum(T a, T b) {
  return isnan(a) ? a : (a > b ? a : b);
}

template<typename T>
__device__ T minimum(T a, T b) {
  return isnan(a) ? a : (a < b ? a : b);
}

extern "C" __global__
void fused_tanh_add(double* t0, double* t1, double* aten_add) {
{
  double v = __ldg(t1 + (64 * (((512 * blockIdx.x + threadIdx.x) / 64) % 24) + ((512 * blockIdx.x + threadIdx.x) / 1536) * 1536) + (512 * blockIdx.x + threadIdx.x) % 64);
  double v_1 = __ldg(t0 + (64 * (((512 * blockIdx.x + threadIdx.x) / 64) % 24) + ((512 * blockIdx.x + threadIdx.x) / 1536) * 1536) + (512 * blockIdx.x + threadIdx.x) % 64);
  aten_add[(64 * (((512 * blockIdx.x + threadIdx.x) / 64) % 24) + ((512 * blockIdx.x + threadIdx.x) / 1536) * 1536) + (512 * blockIdx.x + threadIdx.x) % 64] = (tanh(v)) + v_1;
}
}

I assume this is more likely a non-pytorch issue?
I’m running Ubuntu 20.04, CUDA 11.2, Driver 460.80 and pytorch is 1.8.1+cu111 (So I assume it’s running CUDA 11.1, could that be an issue?)
Thank you!