mumu 0.11.1

Lava Mumu is a language for those in the now and that know
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
  "id": "fn-gpu-scale",
  "dataComponent": "gpu",
  "heading": {
    "title": "scale",
    "badges": ["GPU", "PARTIAL"]
  },
  "synopsis": "Multiplies every element of a 2D tensor by a scalar (int/float) on the GPU, returning a new tensor of the same shape. Partial usage is allowed.",
  "codeBlocks": [
    "extend(\"gpu\")\\n\\n# 1) Basic usage => scalar * matrix\\nMat = gpu:to_tensor([[1,2,3,4],[5,6,7,8]])\\nScaled = gpu:scale(10, Mat)\\nslog(gpu:to_array(Scaled))\\n# => [[10.0,20.0,30.0,40.0],[50.0,60.0,70.0,80.0]]\\n\\n# 2) Partial usage => known scalar, missing matrix\\nscaleBy0_5 = gpu:scale(0.5)\\nres = scaleBy0_5(Mat)\\nslog(gpu:to_array(res))\\n# => [[0.5,1.0,1.5,2.0],[2.5,3.0,3.5,4.0]]\\n\\n# 3) If bridging lacks real GPU logic => logs fallback CPU, but result is the same.\\n"
  ],
  "notes": [
    "Takes exactly 2 arguments => (scalar, tensor). The scalar can be int or float. The second must be a 2D float32 tensor.",
    "gpu:scale => elementwise multiplication by the scalar. Returns a new tensor with identical shape.",
    "If GPU is missing or not implemented for scale, logs fallback CPU. Partial usage => e.g. scale(10) => a function expecting the matrix next."
  ]
}