Skip to content

Commit

Permalink
Merge pull request #82 from ziatdinovmax/ziatdinovmax-patch-1
Browse files Browse the repository at this point in the history
Use the same dtype for input indices and targets in preprocess_sparse…
  • Loading branch information
ziatdinovmax authored Feb 7, 2024
2 parents 58e362c + ffb7279 commit 693cd8f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gpax/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def preprocess_sparse_image(sparse_image):
and an array of full indices of the shape (N_full, D) for reconstructing the full image. D is
the image dimensionality (D=2 for a 2D image)
"""
dtype = sparse_image.dtype
# Find non-zero element indices
non_zero_indices = onp.nonzero(sparse_image)
# Create the GP input using the indices
Expand All @@ -164,7 +165,7 @@ def preprocess_sparse_image(sparse_image):
targets = sparse_image[non_zero_indices]
# Generate indices for the entire image
full_indices = onp.array(onp.meshgrid(*[onp.arange(dim) for dim in sparse_image.shape])).T.reshape(-1, sparse_image.ndim)
return gp_input, targets, full_indices
return gp_input.astype(dtype), targets.astype(dtype), full_indices.astype(dtype)


def initialize_inducing_points(X, ratio=0.1, method='uniform', key=None):
Expand Down

0 comments on commit 693cd8f

Please sign in to comment.