code: def test_buffer_donation_instance(getkey):
      num_traces = 0
  
      class F(eqx.Module):
          buffer: jax.Array
          mlp: eqx.nn.MLP
  
          def __init__(self, width: int, depth: int):
              self.mlp = eqx.nn.MLP(
                  width, width, width, depth, key=getkey()
              )
              self.buffer = jnp.zeros((100000,))
  
          def __call__(self, x):
              nonlocal num_traces
              num_traces += 1
              return self.mlp(x), eqx.tree_at(
                  lambda s: s.buffer, self, self.buffer.at[0].add(1)
              )
  
      f = F(10, 3)
      jit_f = eqx.filter_jit(f, donate="all")
      _, new_f = jit_f(jnp.ones((10,)))
      assert num_traces == 1
      assert f.buffer.is_deleted()
  
      jit_f = eqx.filter_jit(new_f, donate="all")
      _, new_f_2 = jit_f(jnp.ones((10,)))
  
      assert num_traces == 1
      assert new_f.buffer.is_deleted()
  
imports: import warnings
  from typing import Union
  import equinox
  import jax
  import jax.numpy
  import jax.random
  import jax.tree_util
  import pytest
  from .helpers import tree_allclose
label_desc: Use image node_id 13 for calling a global function with example usage: test_buffer_donation_instance(getkey) and returns: self,  eqx