TinyChain-Inc / TinyChain-Inc/fensor

Implement and test tensor math operations

Open
#2 0 comments 0 reactions 1 assignee View on GitHub

@aliaksandr-vasilenka-vention is already working on this.

Since Aug 24, 2026.

in progress
Dominant language
Rust
Stars
0
Forks
0
Avg merge
2h 21m
Merged PRs (30d)
1

Description

Summary

Implement and validate `fensor` math-operation traits so non-transactional tensor math reaches v1 parity targets (subject to documented sparse/layout support boundaries and structured unsupported errors).

Scope
  • Implement/complete:
    • `TensorUnary` (`exp`, `ln`, `round`)
    • `TensorMath` (`add`, `sub`, `mul`, `div`, `log`, `pow`, `rem`)
    • `TensorMathScalar` (`*_scalar`)
    • `TensorReduce` (`max`, `min`, `product`, `sum`)
    • `TensorReduceAll` (`max_all`, `min_all`, `product_all`, `sum_all`)
    • `TensorReduceBoolean` (`all`, `any`)
    • `TensorMatMul` (using `matmul_output_shape` contract)
  • Enforce shape/dimension validation with clear structured errors
  • Preserve explicit unsupported boundaries where required (especially sparse edge paths)
Explicit Non-Goals
  • Transaction lifecycle/LSM logic in `tc-collection`
  • Introducing broad new platform abstractions from `ha-ndarray` beyond what is needed for `fensor`
Acceptance Criteria
  • Math op matrix passes for supported dense/sparse cases:
    • unary, binary, scalar, reductions, matmul
  • All shape/dimension validation failures return structured, user-friendly errors
  • `matmul` validation honors `matmul_output_shape` contract
  • Reduction semantics verified:
    • axis reductions with `keepdims`
    • full reductions (`*_all`)
    • boolean reductions (`all/any`)
  • Chained transform + math correctness is validated
  • Unsupported combinations return structured `Error::Unsupported(...)` (or more specific typed errors when available)
  • No `todo!`, `unimplemented!`, or panic-based placeholders in production math paths
Test Plan
  • Add/extend dedicated math tests in `deps/fensor/tests/`:
    • unary/binary/scalar correctness
    • reduce/reduce_all/reduce_boolean correctness
    • matmul shape and numeric correctness
    • dense/sparse parity where supported
    • transform+math composition cases
  • Include negative tests for:
    • invalid shape combinations
    • incompatible matmul dimensions
    • unsupported sparse execution paths

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.