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

Enable Finch dependency from url #69

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions src/finch/julia.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
_FINCH_VERSION = "0.6.31"
_FINCH_HASH = "9177782c-1635-4eb9-9bfb-d9dfa25e6bce"
_FINCH_REPO_PATH = os.environ.get("FINCH_REPO_PATH", default=None)
_FINCH_REPO_URL = os.environ.get("FINCH_URL_PATH", default=None)

if _FINCH_REPO_PATH and _FINCH_REPO_URL:
raise ValueError("FINCH_REPO_PATH and FINCH_URL_PATH can't be set at the same time.")

if _FINCH_REPO_PATH: # Also account for empty string
juliapkg.add(_FINCH_NAME, _FINCH_HASH, path=_FINCH_REPO_PATH, dev=True)
elif _FINCH_REPO_URL:
juliapkg.add(_FINCH_NAME, _FINCH_HASH, url=_FINCH_REPO_URL, dev=True)
else:
deps = juliapkg.deps.load_cur_deps()
if (
Expand Down
6 changes: 5 additions & 1 deletion src/finch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Tensor(_Display, SparseArray):

def __init__(
self,
obj: np.ndarray | spmatrix | Storage | JuliaObj,
obj: np.ndarray | spmatrix | Storage | JuliaObj | "Tensor",
/,
*,
fill_value: np.number | None = None,
Expand Down Expand Up @@ -985,6 +985,10 @@ def eye(


def tensordot(x1: Tensor, x2: Tensor, /, *, axes=2) -> Tensor:
if not isinstance(x1, Tensor):
x1 = Tensor(x1)
if not isinstance(x2, Tensor):
x2 = Tensor(x2)
if isinstance(axes, Iterable):
self_axes = normalize_axis_tuple(axes[0], x1.ndim)
other_axes = normalize_axis_tuple(axes[1], x2.ndim)
Expand Down
Loading