Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

set API has unexpected behavior #7

@bwasti

Description

@bwasti

[Followup to issue #6 (thanks tcoard for filing)]

From an old version of the README, this usage is now not working as expected.

There seem to be old references being cached (X.numpy() != X.to(N).numpy())

import loop_tool as lt
import numpy as np

N, K = lt.Symbol("N"), lt.Symbol("K")

X = lt.Tensor(np.random.randn(128)).to(N)
Z = lt.Tensor(K)

W = (Z.to(N) * X.to(N)).sum(N)

W.unify()
Z.set(np.random.randn(Z.shape[0]))
k = np.sum(Z.numpy() * X.numpy())

assert np.allclose(W.numpy(), np.sum(X.numpy() * Z.numpy()))

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions