code: def test_copy_on_write(self):
      path = Variable(Generic(), None)
      # 'c' means "copy-on-write", which allow the array to be overwritten
      # by an inplace Op in the graph, without modifying the underlying
      # file.
      x = load(path, "int32", (None,), "c")
      # x ** 2 has been chosen because it will work inplace.
      y = (x**2).sum()
      fn = function([path], y)
      # Call fn() twice, to check that inplace ops do not cause trouble
      assert (fn(self.filename) == (self.data**2).sum()).all()
      assert (fn(self.filename) == (self.data**2).sum()).all()
  
file_path: pytensor/tests/tensor/test_io.py
imports: import os
  import numpy
  import pytest
  import pytensor
  from pytensor import function
  from pytensor.graph.basic import Variable
  from pytensor.link.c.type import Generic
  from pytensor.tensor.io import load
label_desc: Use image node_id 4 for calling the TestLoadTensor obj's underlying member method code with example usage: obj.test_copy_on_write() without return types