Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pip installable #24

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gmm_torch/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .gmm import GaussianMixture
2 changes: 1 addition & 1 deletion gmm.py → gmm_torch/gmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from math import pi
from scipy.special import logsumexp
from utils import calculate_matmul, calculate_matmul_n_times
from .utils import calculate_matmul, calculate_matmul_n_times


class GaussianMixture(torch.nn.Module):
Expand Down
2 changes: 1 addition & 1 deletion utils.py → gmm_torch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def calculate_matmul_n_times(n_components, mat_a, mat_b):
mat_a: torch.Tensor (n, k, 1, d)
mat_b: torch.Tensor (1, k, d, d)
"""
res = torch.zeros(mat_a.shape).to(mat_a.device)
res = torch.zeros(mat_a.shape, device=mat_a.device)

for i in range(n_components):
mat_a_i = mat_a[:, i, :, :].squeeze(-2)
Expand Down
16 changes: 16 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import setuptools

try:
with open("README.md", "r") as fh:
long_description = fh.read()
except FileNotFoundError:
long_description = ""


setuptools.setup(
name="gmm_torch",
version="v0.0.1",
url="https://github.com/MilesCranmer/gmm-torch",
install_requires=["numpy", "scipy"],
packages=setuptools.find_packages(),
)