Closed chadat23 closed 1 month ago
How much memory does your system have?
Are you following a specific tutorial here? It looks like you're adapting https://github.com/kumaraayush67/NNFS from Python?
I don't see a Tensor
initializer that will take a tuple of tuples like this. (In which case the compiler should really give a more helpful error than "out of memory.").
But you could initialize a Tensor with a variadic list of values. That would look like this:
`var weights = Tensor[DType.float64](shape, 0.2, 0.8, -0.5, 1, 0.5, -0.91, 0.26, -0.5, -0.26, -0.27, 0.17, 0.87)`
If you copied this Mojo code from somewhere, please let us know so we can get it fixed.
Only 6 gigs of ram (I wasn't planning on running meaningful modelings on this computer, just learn some language basics)
Motivated by the second comment, I ended up with the below code which runs.
from tensor import Tensor, TensorShape
def main(): var inputs = SIMD[DType.float64, 4](1, 2, 3, 2.5) var weights = Tensor[DType.float64]( TensorShape(3, 4), 0.2, 0.8, -0.5, 1, 0.5, -0.91, 0.26, -0.5, -0.26, -0.27, 0.17, 0.87 ) var biases = SIMD[DType.float64, 4](2, 3, 0.5)
var outputs = SIMD[DType.float64, 4](0, 0, 0)
for i in range(weights.dim(0)):
for j in range(weights.dim(1)):
outputs[i] += inputs[i] * weights[i][j]
outputs[i] += biases[i]
print(outputs)
Bug description
I had some very basic tutorial sorts of things working, then I tried to get a little fancier, using tensors, and received the below message:
(nnfs) chad@ComputerBot:~/mojo/nnfs$ mojo ch02.mojo LLVM ERROR: out of memory Allocation failed [14384:14384:20240920,235455.687881:ERROR elf_dynamic_array_reader.h:64] tag not found [14384:14384:20240920,235455.688169:ERROR elf_dynamic_array_reader.h:64] tag not found [14384:14384:20240920,235455.688755:ERROR elf_dynamic_array_reader.h:64] tag not found [14384:14384:20240920,235455.688852:ERROR elf_dynamic_array_reader.h:64] tag not found 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:
LLVM_SYMBOLIZER_PATH
to point to it): 0 mojo 0x000055d0c093847b 1 mojo 0x000055d0c09363d9 2 mojo 0x000055d0c0938b1d 3 libc.so.6 0x00007fa4280b9050 4 libc.so.6 0x00007fa428107e3c 5 libc.so.6 0x00007fa4280b8fb2 gsignal + 18 6 libc.so.6 0x00007fa4280a3472 abort + 211 7 mojo 0x000055d0c0905df9 8 mojo 0x000055d0c0905e45 9 libAsyncRTRuntimeGlobals.so 0x00007fa4285653c3 10 libAsyncRTRuntimeGlobals.so 0x00007fa428574164 11 libKGENCompilerRTShared.so 0x00007fa424ede389 KGEN_CompilerRT_AlignedAlloc + 137 12 libKGENCompilerRTShared.so 0x00007fa3cf1b7348 KGEN_CompilerRT_AlignedAlloc + 18446744072269697096 mojo crashed! Please file a bug report. Aborted (core dumped)It happened every time I tried to run the code. I don't know what to make of it but it says to submit a bug report so...!
Steps to reproduce
Here's the code:
from tensor import Tensor
def main(): var inputs = SIMD[DType.float64, 4](1, 2, 3, 2.5) var weights = Tensor[DType.float64](3, 4) weights = ((0.2, 0.8, -0.5, 1), (0.5, -0.91, 0.26, -0.5), (-0.26, -0.27, 0.17, 0.87)) var biases = SIMD[DType.float64, 4](2, 3, 0.5)
System information