Giter Site home page Giter Site logo

basalt-org / basalt Goto Github PK

View Code? Open in Web Editor NEW
373.0 11.0 24.0 13.14 MB

A Machine Learning framework from scratch in Pure Mojo ๐Ÿ”ฅ

Home Page: https://basalt-docs.vercel.app/

License: Other

Python 1.87% Mojo 98.13%
ai autograd deep-learning deep-neural-networks machine-learning ml mojo neural-network tensor

basalt's Introduction


Logo

Basalt

A Machine Learning framework from scratch in pure Mojo ๐Ÿ”ฅ

About The Project

Basalt is a stand-alone machine learning framework that leverages the power of Mojo.

As discussed by Modular, Mojo is a language for the future of AI development. Built on top of MLIR technology, rather than existing GCC and LLVM approaches, Mojo looks and feels like Python code, yet performs much closer to languages like Rust or C++. Parametric functions and compile time parameters allow for the graph to statically compiled. Having the static graph allows for much harder performance optimizations.

Basalt, while still in its infancy, is able to achieve speeds comparable to well established frameworks like Pytorch. Below a snapshot of the current benchmarks. But keep posted, there is much more room for improvement and we are upgrading the project on a daily basis.

basalt_benchmark

Quick Start

Try out the benchmarks yourself:

mojo -I . examples/housing.mojo
mojo -I . examples/sin_estimate.mojo
mojo -I . examples/mnist.mojo

Compare to the alternative PyTorch implementation:
Make sure to install the requirements in python-requirements.txt in your python environment.

python examples/housing.py
python examples/sin_estimate.py
python examples/mnist.py

Roadmap

v0.1.0 โœ…

  • Improve matrix multiplication and convolution kernels
  • Switch to custom Tensor and TensorShape implementations
  • Improve benchmarks and overall model execution performance
  • Add profiling and additional performance tests

v0.2.0 (WIP)

  • Add additional operators: Slice, (Un)Squeeze, Concat, Clip, Gather, Split, FMA ...
  • Better layer support and more activation functions
  • Graph submodules & graph concatenation
  • Computer vision benchmark.

Long-Term

  • Better parallelization
  • GPU support
  • Reworked Dataloader
  • Autotuning and related features
  • Graph compilation optimizations
  • Operator fusion
  • ONNX / Max compatibility

Contributing

Basalt is built by community efforts and relies on your expertise and enthousiasm!
Small fixes and improvements are much appreciated. If you are considering larger contributions, feel free to contact us for a smoother communication channel on Discord. If you find a bug or have an idea for a feature, please use our issue tracker. Before creating a new issue, please:

  • Check if the issue already exists. If an issue is already reported, you can contribute by commenting on the existing issue.
  • If not, create a new issue and include all the necessary details to understand/recreate the problem or feature request.

Creating A Pull Request

  1. Fork the Project
  2. Create your Feature Branch
  3. Commit your Changes
  4. Push to the Branch
  5. Open a Pull Request

Once your changes are pushed, navigate to your fork on GitHub. And create a pull request against the original basalt-org/basalt repository.

  • Before creating a PR make sure it doesn't break any of the unit-tests. (e.g. mojo run -I . test/test_ops.mojo)
  • Introducing new big features requires a new test!
  • In the pull request, provide a detailed description of the changes and why they're needed. Link any relevant issues.
  • If there are any specific instructions for testing or validating your changes, include those as well.

License

Distributed under the Apache 2.0 License with LLVM Exceptions. See LICENSE and the LLVM License for more information.

Acknowledgements

basalt's People

Contributors

andresnowak avatar benny-nottonson avatar fnands avatar frostythesouthernsnowman avatar jackos avatar stijn-woestenborghs avatar stijnwoestenborghs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

basalt's Issues

Debugging examples

I don't think this is the best place to ask for help on this, but ...

I want to debug the file ./examples/housing.mojo that imports the package ./basalt. When I try to debug the file with Mojo's VSCode debugger, I get the error message unable to locate module 'basalt', the same error message that throws if I try to run ./examples/housing.mojo without setting the path argument (-I), so it seems like the problem is that I have to specify the path argument for the debugger too. I tried to update the launch file configuration by setting the args property to ["-I", "../"] (I have also tried "." and "./basalt"), which does show up in the final command but still doesn't work, throwing the same error message.

So my question is how to set up the correct debugging profile to debug the basalt package in Mojo.

Bug - Running examples/housing.mojo benchmark

Mojo Error Log

Command

mojo run -I . examples/housing.mojo

Errors Encountered

Module Import Errors

  • Unable to locate module 'unsafe_pointer'
  • Unable to locate module 'numerics'

Unknown Declaration Errors

  • Unknown declaration 'EqualityComparable'
  • Unknown declaration 'List'
  • Module 'optional' does not contain 'OptionalReg'

Other Errors

  • Expected parameter name
  • Expected decl in symbol table to appear in lookup: utils

Full Error Stack

Included from ./basalt/__init__.mojo:3:
./basalt/utils/collection.mojo:1:6: error: unable to locate module 'unsafe_pointer'
from memory.unsafe_pointer import UnsafePointer, initialize_pointee_move, destroy_pointee
     ^
Included from /Users/huvinesh/basalt/examples/housing.mojo:6:
Included from ./basalt/utils/datasets.mojo:5:
./basalt/utils/tensorutils.mojo:6:6: error: unable to locate module 'numerics'
from utils.numerics import min_finite, max_finite
     ^
Included from ./basalt/autograd/__init__.mojo:1:
./basalt/autograd/symbol.mojo:6:46: error: use of unknown declaration 'EqualityComparable'
struct Symbol(CollectionElement, Stringable, EqualityComparable):
                                             ^~~~~~~~~~~~~~~~~~
Included from ./basalt/autograd/__init__.mojo:2:
./basalt/autograd/graph.mojo:15:17: error: use of unknown declaration 'List'
    var inputs: List[Symbol]
                ^~~~
Included from ./basalt/autograd/__init__.mojo:2:
Included from ./basalt/autograd/graph.mojo:8:
./basalt/autograd/params.mojo:59:18: error: use of unknown declaration 'List'
    var symbols: List[Symbol]
                 ^~~~
Included from ./basalt/autograd/__init__.mojo:2:
Included from ./basalt/autograd/graph.mojo:8:
./basalt/autograd/params.mojo:60:17: error: use of unknown declaration 'List'
    var values: List[Param]
                ^~~~
Included from ./basalt/autograd/__init__.mojo:2:
./basalt/autograd/graph.mojo:17:16: error: use of unknown declaration 'List'
    var nodes: List[Node]
               ^~~~
Included from ./basalt/autograd/__init__.mojo:2:
./basalt/autograd/graph.mojo:18:18: error: use of unknown declaration 'List'
    var outputs: List[Symbol]
                 ^~~~
Included from ./basalt/autograd/__init__.mojo:2:
./basalt/autograd/graph.mojo:2:44: error: module 'optional' does not contain 'OptionalReg'
from collections.optional import Optional, OptionalReg
                                           ^
Included from ./basalt/nn/__init__.mojo:2:
./basalt/nn/model.mojo:1:44: error: module 'optional' does not contain 'OptionalReg'
from collections.optional import Optional, OptionalReg
                                           ^
Included from ./basalt/nn/__init__.mojo:2:
Included from ./basalt/nn/model.mojo:11:
./basalt/utils/perf_utils.mojo:46:31: error: use of unknown declaration 'List'
    var forward_perf_metrics: List[PerfMetricsValues]
                              ^~~~
Included from ./basalt/nn/__init__.mojo:2:
Included from ./basalt/nn/model.mojo:11:
./basalt/utils/perf_utils.mojo:47:32: error: use of unknown declaration 'List'
    var backward_perf_metrics: List[PerfMetricsValues]
                               ^~~~
./basalt/nn/optim.mojo:26:176: error: expected parameter name
    lifetime: MutableLifetime, # using mutability and anylifetime, seems to give problem for now because the the reference can't now for sure if the lifetime is mutable or not
                                                                                                                                                                               ^
LLVM ERROR: expected decl in symbol table to appear in lookup: utils
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0.	Program arguments: mojo run -I . examples/housing.mojo
1.	Crash resolving decl body at loc("/Users/huvinesh/basalt/examples/housing.mojo":25:1)
    >> fn main():
       ^.........
    >>     # Train Parameters
    >>     alias batch_size = 32
    >>     alias num_epochs = 200
    >>     alias learning_rate = 0.02
2.	Crash parsing statement at loc("/Users/huvinesh/basalt/examples/housing.mojo":40:5)
    >>     print("Loading data...")
           ^.......................<
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  mojo                     0x0000000102426664 llvm_strlcpy + 52684
1  mojo                     0x00000001024247c4 llvm_strlcpy + 44844
2  mojo                     0x0000000102426d04 llvm_strlcpy + 54380
3  libsystem_platform.dylib 0x000000019d192184 _sigtramp + 56
4  libsystem_pthread.dylib  0x000000019d15bf70 pthread_kill + 288
5  libsystem_c.dylib        0x000000019d068908 abort + 128
6  mojo                     0x00000001023bc19c llvm_blake3_hasher_finalize_seek + 245608
7  mojo                     0x00000001027c0b80 llvm_strlcpy + 3830504
8  mojo                     0x00000001027c0a54 llvm_strlcpy + 3830204
9  mojo                     0x00000001027c0ebc llvm_strlcpy + 3831332
10 mojo                     0x00000001028897b0 llvm_strlcpy + 4652824
11 mojo                     0x000000010288ab24 llvm_strlcpy + 4657804
12 mojo                     0x00000001028da840 llvm_strlcpy + 4984744
13 mojo                     0x000000010288986c llvm_strlcpy + 4653012
14 mojo                     0x000000010288aa9c llvm_strlcpy + 4657668
15 mojo                     0x00000001028bf304 llvm_strlcpy + 4872812
16 mojo                     0x00000001028895ec llvm_strlcpy + 4652372
17 mojo                     0x000000010288aa58 llvm_strlcpy + 4657600
18 mojo                     0x00000001028a76e0 llvm_strlcpy + 4775496
19 mojo                     0x00000001028895ec llvm_strlcpy + 4652372
20 mojo                     0x00000001027bd93c llvm_strlcpy + 3817636
21 mojo                     0x0000000102763f38 llvm_strlcpy + 3450528
22 mojo                     0x00000001027b7558 llvm_strlcpy + 3792064
23 mojo                     0x000000010277f670 llvm_strlcpy + 3562968
24 mojo                     0x00000001027793f4 llvm_strlcpy + 3537756
25 mojo                     0x00000001027835bc llvm_strlcpy + 3579172
26 mojo                     0x00000001027795f4 llvm_strlcpy + 3538268
27 mojo                     0x00000001027acc3c llvm_strlcpy + 3748772
28 mojo                     0x00000001027aab2c llvm_strlcpy + 3740308
29 mojo                     0x00000001027aa9c8 llvm_strlcpy + 3739952
30 mojo                     0x0000000102753790 llvm_strlcpy + 3383032
31 mojo                     0x00000001027645b4 llvm_strlcpy + 3452188
32 mojo                     0x0000000102764c58 llvm_strlcpy + 3453888
33 mojo                     0x000000010276c878 llvm_strlcpy + 3485664
34 mojo                     0x000000010276cb98 llvm_strlcpy + 3486464
35 mojo                     0x000000010236e980
36 mojo                     0x000000010237e4d8
37 mojo                     0x00000001023690a0
38 dyld                     0x000000019cddb274 start + 2840
[6617:74732:20240711,140832.087651:WARNING in_range_cast.h:38] value -634136515 out of range
[6617:74732:20240711,140832.095161:WARNING crash_report_exception_handler.cc:257] UniversalExceptionRaise: (os/kern) failure (5)
[1]    6615 abort      mojo run -I . examples/housing.mojo

Constructive Critique and Improvement Suggestions for Basalt's Frontend APIs

I have tried to build a simple model with Basalt to get a sense of its frontend APIs and how it works and I have a few comments I would like to share.

It is a simple linear regression model that has the following code:

from basalt import Graph, Tensor, TensorShape, nn, dtype
from basalt.utils import tensorutils
from random import randn


fn create_model_graph() -> Graph:
    var g = Graph()

    var x = g.input(TensorShape(800, 2))
    var y_pred = nn.Linear(g, x, 1)
    g.out(y_pred)
    var y_true = g.input(TensorShape(800, 1))
    var loss = nn.MSELoss(g, y_pred, y_true)
    g.loss(loss)

    return g


fn main() raises:
    alias graph = create_model_graph()
    var model = nn.Model[graph]()
    var optim = nn.optim.Adam[graph](lr=0.01)
    optim.allocate_rms_and_momentum(model.parameters)

    var X_train_data = DTypePointer[dtype].alloc(800 * 2)
    randn(X_train_data, 800 * 2)
    var X_train = Tensor[dtype](X_train_data, TensorShape(800, 2))

    var true_weights = Tensor[dtype](TensorShape(2, 1))
    true_weights[0] = 2
    true_weights[1] = 3

    var y_train = Tensor[dtype](TensorShape(800, 1))
    tensorutils.dot[TensorShape(800, 2), TensorShape(2, 1)](
        y_train, X_train, true_weights
    )

    var X_test_data = DTypePointer[dtype].alloc(200 * 2)
    randn(X_test_data, 200 * 2)
    var X_test = Tensor[dtype](X_test_data, TensorShape(200, 2))

    var y_test = Tensor[dtype](TensorShape(200, 1))
    tensorutils.dot[TensorShape(200, 2), TensorShape(2, 1)](
        y_test, X_test, true_weights
    )

    for epoch in range(1000):
        var loss = model.forward(X_train, y_train)[0]
        optim.zero_grad(model.parameters)
        model.backward()
        optim.step(model.parameters)
        if epoch == 0 or (epoch + 1) % 100 == 0:
            print("Epoch: ", epoch + 1, ", Loss: ", loss, sep="")

    var test_loss = model.forward(X_test, y_test)[0]
    print("Test Loss: ", test_loss, sep="")
    print("Params: ", model.parameters.params.data[2])

My main point is that the frontend has a bad user experience. It isn't clear what the Graph API is doing at first glance, and once you realize it is for describing your model in some sort of DSL before populating it, it doesn't get easier to use it. It isn't intuitive that you have to describe your model's graph in terms of input, out, loss, param, etc. nodes, and the APIs for specifying them aren't great either.
Another pain point is the APIs for initializing tensors. I think it is clear from my code where the problem is. Most of the main function's body went for initializing simple train and test tensors.

I think the frontend can be a lot simpler. A good north star to work towards is Pytorch's frontend. tinygrad is an example of a recent framework that is applying this successfully. The result is a simple and intuitive frontend that users are already familiar with or is easy to familiarize themselves with. Here is the code for the same model in Python Pytorch:

import torch

X = torch.randn(1000, 2)
y = X.mv(torch.tensor([2, 3], dtype=torch.float))
X_train = X[:800]
y_train = y[:800]
X_test = X[800:]
y_test = y[800:]

class LinearRegression(torch.nn.Module):
    def __init__(self):
        super(LinearRegression, self).__init__()
        self.linear = torch.nn.Linear(2, 1)

    def forward(self, x):
        return self.linear(x)

model = LinearRegression()
criterion = torch.nn.MSELoss()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

for epoch in range(1000):
    optimizer.zero_grad()
    outputs = model(X_train)
    loss = criterion(outputs.squeeze(), y_train)
    loss.backward()
    optimizer.step()
    if epoch == 0 or (epoch + 1) % 100 == 0:
        print(f'Epoch {epoch + 1}, Loss: {loss.item()}')

with torch.no_grad():
    y_pred = model(X_test)
    loss = criterion(y_pred.squeeze(), y_test)
    print(f'Test loss: {loss.item()}')
    print(f'Model params: {model.linear.weight[0].numpy()} vs True weights: [2, 3]')

I'm new to Mojo so I don't know how easy is this to pull off. However, I think this is necessary if the project hopes to compete with existing alternatives (it is not enough that the code is written in Mojo) and it seems that the current frontend is far from the simplest form it can take.

These are my two cents, I hope you accept them ..

error: package 'math' does not contain 'max'

Hello,
I am new to mojo and I am trying to run an example basalt neural network. However, I am getting an error.

I installed the nightly release of mojo: mojo 2024.5.1705 (6569da05)
I then cloned the basalt repository latest commit -> hash: 1ddfa68
Then I try to run mojo -I . examples/housing.mojo
However I get a long error:

Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/autograd/graph.mojo:4:
Included from /home/jure/Projekti/basalt/basalt/autograd/node.mojo:7:
/home/jure/Projekti/basalt/basalt/autograd/attributes.mojo:45:21: error: use of unknown declaration 'StaticTuple'
    var attributes: StaticTuple[Attribute, MAX_ATTRS]
                    ^~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:25:
/home/jure/Projekti/basalt/basalt/utils/bytes.mojo:13:15: error: use of unknown declaration 'StaticTuple'
    var data: StaticTuple[UInt8, capacity]
              ^~~~~~~~~~~
/home/jure/Projekti/basalt/examples/housing.mojo:37:37: error: invalid initialization: could not deduce parameter 'mutability' of parent struct 'Adam'
    var optim = nn.optim.Adam[graph](Reference(model.parameters), lr=learning_rate)
                ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/optim.mojo:23:8: note:  struct declared here
struct Adam[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/optim.mojo:40:8: note: function declared here
    fn __init__(
       ^
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/autograd/graph.mojo:4:
Included from /home/jure/Projekti/basalt/basalt/autograd/node.mojo:7:
/home/jure/Projekti/basalt/basalt/autograd/attributes.mojo:50:27: error: use of unknown declaration 'StaticTuple', 'fn' declarations require explicit variable declarations
        self.attributes = StaticTuple[Attribute, MAX_ATTRS]()
                          ^~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/autograd/graph.mojo:4:
Included from /home/jure/Projekti/basalt/basalt/autograd/node.mojo:7:
/home/jure/Projekti/basalt/basalt/autograd/attributes.mojo:53:17: error: 'AttributeVector' value has no attribute 'attributes'
            self.attributes[i] = attributes[i]
            ~~~~^
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/autograd/graph.mojo:4:
Included from /home/jure/Projekti/basalt/basalt/autograd/node.mojo:7:
/home/jure/Projekti/basalt/basalt/autograd/attributes.mojo:61:20: error: 'AttributeVector' value has no attribute 'attributes'
        return self.attributes[index]
               ~~~~^
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/autograd/graph.mojo:4:
Included from /home/jure/Projekti/basalt/basalt/autograd/node.mojo:7:
/home/jure/Projekti/basalt/basalt/autograd/attributes.mojo:66:20: error: 'AttributeVector' value has no attribute 'attributes'
            if self.attributes[i].name == Bytes[MAX_NAME_CHARS](index):
               ~~~~^
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/autograd/graph.mojo:4:
Included from /home/jure/Projekti/basalt/basalt/autograd/node.mojo:7:
/home/jure/Projekti/basalt/basalt/autograd/attributes.mojo:74:26: error: 'AttributeVector' value has no attribute 'attributes'
            s += str(self.attributes[i])
                     ~~~~^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:25:
/home/jure/Projekti/basalt/basalt/utils/bytes.mojo:17:20: error: use of unknown declaration 'StaticTuple', 'fn' declarations require explicit variable declarations
        var data = StaticTuple[UInt8, capacity]()
                   ^~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:25:
/home/jure/Projekti/basalt/basalt/utils/bytes.mojo:27:20: error: use of unknown declaration 'StaticTuple', 'fn' declarations require explicit variable declarations
        var data = StaticTuple[UInt8, capacity]()
                   ^~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:1:18: error: package 'math' does not contain 'min'
from math import min
                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:21:50: error: unexpected token in expression
        for i in range(min(self._rank, MAX_RANK)):
                                                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:21:50: error: statements must start at the beginning of a line
        for i in range(min(self._rank, MAX_RANK)):
                                                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:28:50: error: unexpected token in expression
        for i in range(min(self._rank, MAX_RANK)):
                                                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:28:50: error: statements must start at the beginning of a line
        for i in range(min(self._rank, MAX_RANK)):
                                                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:35:50: error: unexpected token in expression
        for i in range(min(self._rank, MAX_RANK)):
                                                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:35:50: error: statements must start at the beginning of a line
        for i in range(min(self._rank, MAX_RANK)):
                                                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:42:50: error: unexpected token in expression
        for i in range(min(self._rank, MAX_RANK)):
                                                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:42:50: error: statements must start at the beginning of a line
        for i in range(min(self._rank, MAX_RANK)):
                                                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:54:50: error: unexpected token in expression
        for i in range(min(self._rank, MAX_RANK)):
                                                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:54:50: error: statements must start at the beginning of a line
        for i in range(min(self._rank, MAX_RANK)):
                                                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:100:39: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
        return self.parameters.tensors[g.loss_out.value()]
               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:100:39: note: failed to infer parameter 'mutability', parameter isn't used in any argument
        return self.parameters.tensors[g.loss_out.value()]
               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:116:36: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
            self.parameters.tensors[g.inputs[i]] = t_input[i]
            ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:116:36: note: failed to infer parameter 'mutability', parameter isn't used in any argument
            self.parameters.tensors[g.inputs[i]] = t_input[i]
            ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:146:48: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                        self.parameters.tensors[out], self.parameters.tensors[t1]
                        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:146:48: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                        self.parameters.tensors[out], self.parameters.tensors[t1]
                        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:152:48: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                        self.parameters.tensors[out],
                        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:152:48: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                        self.parameters.tensors[out],
                        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:161:48: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                        self.parameters.tensors[out],
                        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:161:48: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                        self.parameters.tensors[out],
                        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:181:39: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
            fill(self.parameters.grads[g.loss_out.value()], 1.0)
                 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:181:39: note: failed to infer parameter 'mutability', parameter isn't used in any argument
            fill(self.parameters.grads[g.loss_out.value()], 1.0)
                 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:190:38: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                self.parameters.grads[node_outputs[i]] = upper_grads[i]
                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:190:38: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                self.parameters.grads[node_outputs[i]] = upper_grads[i]
                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:215:50: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                            self.parameters.grads[g.nodes[reverse_i].inputs[j]],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:215:50: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                            self.parameters.grads[g.nodes[reverse_i].inputs[j]],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:232:50: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:232:50: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:244:50: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:244:50: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:253:50: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:253:50: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:269:50: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:269:50: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:281:50: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:281:50: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:293:50: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
/home/jure/Projekti/basalt/basalt/nn/model.mojo:293:50: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                            self.parameters.grads[out],
                            ~~~~~~~~~~~~~~~~~~~~~^~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:1:18: error: package 'math' does not contain 'max'
from math import max
                 ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
/home/jure/Projekti/basalt/basalt/nn/tensor.mojo:148:34: error: 'Tensor[dtype]' value has no attribute 'data'
        memcpy(self._data, tensor.data(), self._shape.num_elements())
                           ~~~~~~^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:9:
/home/jure/Projekti/basalt/basalt/utils/tensorutils.mojo:4:46: error: package 'math' does not contain 'add'
from math import sqrt, pow, equal, max, min, add, div, divmod, abs
                                             ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:9:
/home/jure/Projekti/basalt/basalt/utils/tensorutils.mojo:4:51: error: package 'math' does not contain 'div'
from math import sqrt, pow, equal, max, min, add, div, divmod, abs
                                                  ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:25:
/home/jure/Projekti/basalt/basalt/utils/bytes.mojo:42:13: error: 'Bytes[capacity]' value has no attribute 'data'
        self.data[index] = value
        ~~~~^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:25:
/home/jure/Projekti/basalt/basalt/utils/bytes.mojo:46:20: error: 'Bytes[capacity]' value has no attribute 'data'
        return self.data[index]
               ~~~~^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:9:
/home/jure/Projekti/basalt/basalt/utils/tensorutils.mojo:4:36: error: package 'math' does not contain 'max'
from math import sqrt, pow, equal, max, min, add, div, divmod, abs
                                   ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:9:
/home/jure/Projekti/basalt/basalt/utils/tensorutils.mojo:4:64: error: package 'math' does not contain 'abs'
from math import sqrt, pow, equal, max, min, add, div, divmod, abs
                                                               ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:9:
/home/jure/Projekti/basalt/basalt/utils/tensorutils.mojo:62:43: error: unexpected token in expression
    for i in range(ndim - 1, diff - 1, -1):
                                          ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:9:
/home/jure/Projekti/basalt/basalt/utils/tensorutils.mojo:62:43: error: statements must start at the beginning of a line
    for i in range(ndim - 1, diff - 1, -1):
                                          ^
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:9:
/home/jure/Projekti/basalt/basalt/utils/tensorutils.mojo:4:56: error: package 'math' does not contain 'divmod'
from math import sqrt, pow, equal, max, min, add, div, divmod, abs
                                                       ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:1:
/home/jure/Projekti/basalt/basalt/autograd/ops/basics.mojo:1:33: error: package 'math' does not contain 'div'
from math import add, sub, mul, div, log, exp
                                ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:1:
/home/jure/Projekti/basalt/basalt/autograd/ops/basics.mojo:1:28: error: package 'math' does not contain 'mul'
from math import add, sub, mul, div, log, exp
                           ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:21:
/home/jure/Projekti/basalt/basalt/autograd/ops/pool.mojo:1:11: error: unable to locate module 'limit'
from math.limit import neginf
          ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:1:
/home/jure/Projekti/basalt/basalt/autograd/ops/basics.mojo:1:18: error: package 'math' does not contain 'add'
from math import add, sub, mul, div, log, exp
                 ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:1:
/home/jure/Projekti/basalt/basalt/autograd/ops/basics.mojo:1:23: error: package 'math' does not contain 'sub'
from math import add, sub, mul, div, log, exp
                      ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:20:
/home/jure/Projekti/basalt/basalt/autograd/ops/conv.mojo:6:18: error: package 'math' does not contain 'divmod'
from math import divmod
                 ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:19:
/home/jure/Projekti/basalt/basalt/autograd/ops/dynamics.mojo:50:39: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                    parameters.tensors[outputs[0]].data()
                    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:19:
/home/jure/Projekti/basalt/basalt/autograd/ops/dynamics.mojo:50:39: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                    parameters.tensors[outputs[0]].data()
                    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:19:
/home/jure/Projekti/basalt/basalt/autograd/ops/dynamics.mojo:76:33: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                parameters.grads[outputs[0]].data()
                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:19:
/home/jure/Projekti/basalt/basalt/autograd/ops/dynamics.mojo:76:33: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                parameters.grads[outputs[0]].data()
                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:19:
/home/jure/Projekti/basalt/basalt/autograd/ops/dynamics.mojo:131:39: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                    parameters.tensors[outputs[j]].data() + i * chunks[j],
                    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:19:
/home/jure/Projekti/basalt/basalt/autograd/ops/dynamics.mojo:131:39: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                    parameters.tensors[outputs[j]].data() + i * chunks[j],
                    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:19:
/home/jure/Projekti/basalt/basalt/autograd/ops/dynamics.mojo:162:37: error: invalid call to '__refitem__': callee expects 2 parameters, but 0 were specified
                    parameters.grads[outputs[j]].data() + i * chunks[j],
                    ~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:19:
/home/jure/Projekti/basalt/basalt/autograd/ops/dynamics.mojo:162:37: note: failed to infer parameter 'mutability', parameter isn't used in any argument
                    parameters.grads[outputs[j]].data() + i * chunks[j],
                    ~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/nn/__init__.mojo:2:
Included from /home/jure/Projekti/basalt/basalt/nn/model.mojo:8:
/home/jure/Projekti/basalt/basalt/utils/collection.mojo:118:8: note: function declared here
    fn __refitem__[
       ^
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/__init__.mojo:1:
Included from /home/jure/Projekti/basalt/basalt/autograd/ops/ops.mojo:18:
/home/jure/Projekti/basalt/basalt/autograd/ops/mlops.mojo:2:28: error: package 'math' does not contain 'max'
from math import exp, pow, max, min, abs
                           ^
mojo: error: failed to parse the provided Mojo source module

What is the problem here?

Mojopkg gh action

I could create some GH actions to Stu run the tests and make mojopkg files for release :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.