# Buggy code
def transform(self, X, y=None):
    """Compute multi-channel raster images from diagrams in `X` by
        convolution with a Gaussian kernel and reflection about the diagonal.

        Parameters
        ----------
        X : ndarray of shape (n_samples, n_features, 3)
            Input data. Array of persistence diagrams, each a collection of
            triples [b, d, q] representing persistent topological features
            through their birth (b), death (d) and homology dimension (q).

        y : None
            There is no need for a target in a transformer, yet the pipeline
            API requires this parameter.

        Returns
        -------
        Xt : ndarray of shape (n_samples, n_homology_dimensions, n_bins, \
            n_bins)
            Multi-channel raster images: one image per sample and one
            channel per homology dimension seen in :meth:`fit`. Index i
            along axis 1 corresponds to the i-th homology dimension in
            :attr:`homology_dimensions_`.

        """
    check_is_fitted(self)
    X = check_diagrams(X, copy=True)

    Xt = Parallel(n_jobs=self.n_jobs)(
        delayed(heats)(
            _subdiagrams(X, [dim], remove_dim=True)[s],
            self._samplings[dim],
            self._step_size[dim],
            self.sigma,
        )
        for dim in self.homology_dimensions_
        for s in gen_even_slices(X.shape[0], effective_n_jobs(self.n_jobs))
    )
    Xt = (
        np.concatenate(Xt)
        .reshape(self._n_dimensions, X.shape[0], self.n_bins, self.n_bins)
        .transpose((1, 0, 2, 3))
    )
    return Xt


# Traceback (ValueError)
---------------------------------------------------------------------------
_RemoteTraceback                          Traceback (most recent call last)
_RemoteTraceback: 
"""
Traceback (most recent call last):
  File "C:\Users\nicho\Anaconda3\lib\site-packages\joblib\externals\loky\process_executor.py", line 418, in _process_worker
    r = call_item()
  File "C:\Users\nicho\Anaconda3\lib\site-packages\joblib\externals\loky\process_executor.py", line 272, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "C:\Users\nicho\Anaconda3\lib\site-packages\joblib\_parallel_backends.py", line 567, in __call__
    return self.func(*args, **kwargs)
  File "C:\Users\nicho\Anaconda3\lib\site-packages\joblib\parallel.py", line 225, in __call__
    for func, args, kwargs in self.items]
  File "C:\Users\nicho\Anaconda3\lib\site-packages\joblib\parallel.py", line 225, in <listcomp>
    for func, args, kwargs in self.items]
  File "C:\Users\nicho\Anaconda3\lib\site-packages\gtda\diagrams\_metrics.py", line 86, in heats
    diagrams[diagrams < sampling[0, 0]] = sampling[0, 0]
ValueError: assignment destination is read-only
"""

The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)
<ipython-input-132-73d0b2c011fe> in <module>
      7 hk = HeatKernel(sigma=1, n_bins=n_bins, n_jobs=2)
      8 num_dimensions = 1
----> 9 x_t = hk.fit_transform(diagrams)

~\Anaconda3\lib\site-packages\gtda\utils\_docs.py in fit_transform_wrapper(*args, **kwargs)
    104         @wraps(original_fit_transform)
    105         def fit_transform_wrapper(*args, **kwargs):
--> 106             return original_fit_transform(*args, **kwargs)
    107         fit_transform_wrapper.__doc__ = \
    108             make_fit_transform_docs(fit_docs, transform_docs)

~\Anaconda3\lib\site-packages\sklearn\base.py in fit_transform(self, X, y, **fit_params)
    569         if y is None:
    570             # fit method of arity 1 (unsupervised transformation)
--> 571             return self.fit(X, **fit_params).transform(X)
    572         else:
    573             # fit method of arity 2 (supervised transformation)

~\Anaconda3\lib\site-packages\gtda\diagrams\representations.py in transform(self, X, y)
    591             heats)(_subdiagrams(X, [dim], remove_dim=True)[s],
    592                    self._samplings[dim], self._step_size[dim], self.sigma)
--> 593             for dim in self.homology_dimensions_
    594             for s in gen_even_slices(X.shape[0],
    595                                      effective_n_jobs(self.n_jobs)))

~\Anaconda3\lib\site-packages\joblib\parallel.py in __call__(self, iterable)
    932 
    933             with self._backend.retrieval_context():
--> 934                 self.retrieve()
    935             # Make sure that we get a last message telling us we are done
    936             elapsed_time = time.time() - self._start_time

~\Anaconda3\lib\site-packages\joblib\parallel.py in retrieve(self)
    831             try:
    832                 if getattr(self._backend, 'supports_timeout', False):
--> 833                     self._output.extend(job.get(timeout=self.timeout))
    834                 else:
    835                     self._output.extend(job.get())

~\Anaconda3\lib\site-packages\joblib\_parallel_backends.py in wrap_future_result(future, timeout)
    519         AsyncResults.get from multiprocessing."""
    520         try:
--> 521             return future.result(timeout=timeout)
    522         except LokyTimeoutError:
    523             raise TimeoutError()

~\Anaconda3\lib\concurrent\futures\_base.py in result(self, timeout)
    430                 raise CancelledError()
    431             elif self._state == FINISHED:
--> 432                 return self.__get_result()
    433             else:
    434                 raise TimeoutError()

~\Anaconda3\lib\concurrent\futures\_base.py in __get_result(self)
    382     def __get_result(self):
    383         if self._exception:
--> 384             raise self._exception
    385         else:
    386             return self._result

ValueError: assignment destination is read-only

# Fixed code
def transform(self, X, y=None):
    """Compute multi-channel raster images from diagrams in `X` by
        convolution with a Gaussian kernel and reflection about the diagonal.

        Parameters
        ----------
        X : ndarray of shape (n_samples, n_features, 3)
            Input data. Array of persistence diagrams, each a collection of
            triples [b, d, q] representing persistent topological features
            through their birth (b), death (d) and homology dimension (q).

        y : None
            There is no need for a target in a transformer, yet the pipeline
            API requires this parameter.

        Returns
        -------
        Xt : ndarray of shape (n_samples, n_homology_dimensions, n_bins, \
            n_bins)
            Multi-channel raster images: one image per sample and one
            channel per homology dimension seen in :meth:`fit`. Index i
            along axis 1 corresponds to the i-th homology dimension in
            :attr:`homology_dimensions_`.

        """
    check_is_fitted(self)
    X = check_diagrams(X, copy=True)

    Xt = Parallel(n_jobs=self.n_jobs, mmap_mode="c")(
        delayed(heats)(
            _subdiagrams(X[s], [dim], remove_dim=True),
            self._samplings[dim],
            self._step_size[dim],
            self.sigma,
        )
        for dim in self.homology_dimensions_
        for s in gen_even_slices(len(X), effective_n_jobs(self.n_jobs))
    )
    Xt = (
        np.concatenate(Xt)
        .reshape(self._n_dimensions, len(X), self.n_bins, self.n_bins)
        .transpose((1, 0, 2, 3))
    )
    return Xt