Skip to content

Type system basics

Chelis keeps tensor dimensions and precision explicit.

  • No implicit precision promotion
  • No implicit broadcasting
  • Named tensor dimensions must match by name
  • Integer literals default to int32, float literals to f32
(t-tensor {} (d-name {} batch) (d-name {} seq) (t-prim {} f32))
tensor[batch, seq, f32]
def add_vec(x: tensor[n, f32], y: tensor[n, f32]) -> tensor[n, f32] = add(x, y)
(defsig {}
add_vec
(t-fn {}
(t-tensor {} (d-name {} n) (t-prim {} f32))
(t-tensor {} (d-name {} n) (t-prim {} f32))
(t-tensor {} (d-name {} n) (t-prim {} f32))))