fibertree-project / fibertree Goto Github PK
View Code? Open in Web Editor NEWFibertree emulator
License: MIT License
Fibertree emulator
License: MIT License
With the following code:
z = Tensor(rank_ids=["M", "N"])
z.setName("Z")
z.setMutable(True)
z_m = z.getRoot()
#
# Hack to fill in all the entries in z
# This allows us to pretend the tensor is dense
#
n_fiber = Fiber(coords=range(N), initial=1)
m_fiber = Fiber(coords=range(M), initial=1)
for m, (z_n, _) in z_m << m_fiber:
for n, (z_ref, _) in z_n << n_fiber:
z_ref <<= 0
z.getRoot()[0][0]
There were two problems:
z.getRoot()[0]
wants to raise an IndexError
. I think this shouldn't happen.IndexError
.Traceback follows.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[11], line 17
14 for n, (z_ref, _) in z_n << n_fiber:
15 z_ref <<= 0
---> 17 z.getRoot()[0][0]
File /usr/local/lib/python3.8/dist-packages/fibertree/core/fiber.py:1874, in Fiber.__getitem__(self, keys)
1871 key += len(self)
1873 if key < 0 or key >= len(self):
-> 1874 raise(IndexError, f"The index ({key}) is out of range")
1876 new_payload = self.payloads[key]
1878 if len(key_cdr):
1879 # Recurse down the fiber tree
TypeError: exceptions must derive from BaseException
Currently a user cannot directly set the default of a Tensor or Fiber to something other than 0 when creating Tensors/Fibers from the fromUncompressed
functions. One fix is to add **kwargs
to the parameter list.
The populate operator (<<
or _lshift_
) currently has the following specs:
An explicit zero in the input will NOT generate a corresponding coordinate in the output
This needs to be updated to an "explicit empty value in the input will NOT generate a corresponding coordinate in the output."
For example, suppose b1_n
below has default empty value as -1
. Currently, the below code does NOT populate b2_n
with coordinates where payloads are 0
, even though in this case, 0
is a valid non-empty value.
b1_n = Fiber.fromUncompressed([0, 1, 2, 0, -1], default=-1)
for n, (b2_s, b1_val) in b2_n << b1_n:
#Bug! this will never print 0 or 3
# (the coordinates for value 0), but it will
# incorrectly print 4
print(n)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.