microsoft / knossos-ksc

Compiler with automatic differentiation
Other
45 stars 10 forks source link

Make shape (t : tensor of scalar) be tuple of ints #745

Open awf opened 3 years ago

awf commented 3 years ago

Currently shape of a Tensor is tensor of shape, and shape of scalar is unit. This is nice and consistent, but depends on codegen to make Tensor D (Tuple) efficient. That's not super-onerous, but it is more stuff in the runtime, and would complicate the cost model. And alternative might be to simply define (shape t: tensor of scalar) = (size t).

toelli-msft commented 3 years ago

Yes, and it's also nice to consider tuples of scalars to be scalars. That way their shape is unit and the shape of tensors of them is just their size.