Hey everyone, i am fairly new to Julia and i am feeling like taking crazy pills. I am coming from numpy/tensorflow and all i want to do is to create a test array with size (1,3) and tile it in the first dimension by 300, so that i have an array of size (300,3).
In numpy i would do it somewhat like this:
out = np.tile( [[1,2,3]], (300,1))
if i try to do the same with julia but my brain is melting and nothing makes sense. I cannot even seem to create a multidimensional array with this line:
a = [ [ 1 2 3] ]
b = Array( [ [ 1, 2, 3 ] ])
because for some reason the size(a) gives (1,), Why doesn’t it look recursivly into its elements and puts together a multidimensional array automatically? It doesn’t even do this when i specify its type as Array as in example b. So the first question is, what is the most consistent/nicest way of putting together multidimensional arrays explicitly?
The tiling also makes my brain hurt:
out = repeat([1;2;3], 1,3)
out2 = repeat([1,2,3], 1,3)
both give the SAME result, but maybe i just missunderstood the ; operator. I eventually got it to work with
permutedims(repeat([1 ,2 , 3], outer = (1,300)), (2,1))
But that does look pretty hacky. Is there another way that does not need to use permutedims, especially since it seemed to crash my kernel a few times, when i was low on RAM? All of this seems kinda weird and not really made for multidimensional arrays like numpy or tensorflow is. Am i simply missing a big package here that handles this more like numpy, or is this just the way it is in julia? I know that i can use numpy in julia via python, but i want to write GPU kernels eventually, and i do not think parallelization will work seemlessly with python numpy arrays. Hope you can clear up some of my missconceptions.