tensor: elementwise operations with broadcasting (slice 2 of #82) #772
Labels
No labels
loop
queue/failed
queue/queued
ready
status/parked
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
torbscript/language#772
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Slice 2 of the
std/tensorepic #82, from TENSOR.md section 11. Slice 1 (#691, PR #695) is onmain:Tensor<Scalar>over aBufferwith shape, strides, construction, indexing,Iterate,Show,Equals.Goal
Elementwise operations with broadcasting on
Tensor<Scalar>:Add,Subtract,Multiply<Scalar>,Divide<Scalar>,Negate,scaled,divided,shifted,mapped,broadcast(to:), the shape errors (decision 13: a mismatch panics with the extents named) and the predicatescanBroadcastWithandTensor.broadcastShape. Broadcasting is NumPy's rule (decision 12), no operand is materialised for the view.Design record
tensor-addandtensor-add-broadcast.Acceptance criteria
a + bof shapes that do not broadcast panics with the message form of decision 13;canBroadcastWithandTensor.broadcastShapeanswer the same question without the stop.broadcast(to:)view is the one place a stride 0 on a longer axis appears.Float64,IntandFixedscalars, the shape-error text.tensor-add(within 1.10 of the hand-written loop) andtensor-add-broadcast(within 1.25) are added and green in forge CI; the TENSOR.md cost table filled in; docs page ofstd/tensorupdated andskills/regenerated.sh tools/gates.sh agreen in forge CI,tools/check-commits.shclean.Seed impact
None expected (ordinary TorbScript); the worker confirms against
CLAUDE.md"Seed and breaking changes" first.Size
One PR, one Conventional Commit (
feat(tensor): elementwise operations with broadcasting). Part of #82 (epic; do not close it).std/tensoron the CPU #82[loop:torbscript] claim implement by session:loop-torbscript-20261114 until 2026-11-14T06:00:00Z
[loop:torbscript] implement: claim released (worker run timed out). PR #773 is open at
c12079f5, CI jobs still pending (runner queue). next: review (argus) once CI is green; a red CI is repaired on the same branch by the next tick.[loop:torbscript] claim implement by session:loop-torbscript-20261114 until 2026-11-14T06:56:00Z
[loop:torbscript] implement: PR #773 is on head
8636dab2. Thepdisc / pdisccheck failed becausebenchmarks/README.mdchanged (the tensor-add rows) without a restamp; stamped it in9957eb06and the check is green now. Reading the diff against the acceptance criteria found three more things, fixed in8636dab2: thetensor-broadcast-panic.stderrnamed line 10 (thecanBroadcastWithline) while the panic is raised on line 11, the TENSOR.md cost-table row fortensor-addsaidFloat64while the measurement usesInt, and ranks 0 to 2 had tests but rank 3 had none (added "shapes of rank 3 broadcast on every axis" for Float64, Int and Fixed). CI state:pdisc,commit messagesandwhat the change touchesare green;ci / gates, tier A/B, bootstrap, conformance and the other jobs were still queued behind the runner backlog after ~30 min, so nothing has compiled yet. Unverified: notorbbinary exists locally, so the std code, the tests, the benchmarks, the 1.10/1.25 ratios, the panic column (8, taken from the precedent that a panic names the start of the binary expression) and the doc examples are all untested; the ratios are recorded bytools/tensor-cost.sh(a measurement, like the slice-1 pairs), not enforced as gates. next: waiting (forge CI running on8636dab2; fix round if a job goes red, otherwise merge gate argus, who is the requested reviewer on #773).[loop:torbscript] claim review-fix by session:loop-torbscript-20261114 until 2026-11-14T05:49:00Z
[loop:torbscript] review-fix: PR #773 head
e5095968showspdisc / pdiscfailing (12 s, 03:27Z). next: a worker reads the check output, restamps or fixes the doc front matter on the branch.[loop:torbscript] review-fix: new head
a85e22a0. pdisc failed because .pdisc-sidecar.yaml had entries for docs/standard-library/tensor.md and its skills mirror, which .pdisc.yaml excludes (docs/, skills/), so "entry has no file". Removed both entries indocs(pdisc): drop sidecar entries for the excluded std/tensor pages; python3 -I tools/pdisc/scripts/pdisc.py check passes and check-commits.sh passes. next: wait for CI, then review (argus)