This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from joblib import Parallel, delayed, effective_n_jobs | |
from gtda.utils.intervals import Interval | |
from gtda.utils.validation import validate_params, check_diagrams | |
from gtda.diagrams._utils import _subdiagrams, _bin, _make_homology_dimensions_mapping, _homology_dimensions_to_sorted_ints | |
from sklearn.base import BaseEstimator, TransformerMixin | |
from sklearn.utils import gen_even_slices | |
from sklearn.utils.validation import check_is_fitted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def make_grid(x, ncols, pad=1): | |
"""Make a grid of images. This is the NumPy version of torchvision.utils.make_grid. | |
Args: | |
x (np.ndarray): 4D mini-batch of np.ndarray with shape (n_samples, height, width, n_channels) | |
ncols (int): the number of images displayed in each row. | |
pad (int, optional): the size of white space around each image. Defaults to 1. |