tensor.rewriting.basic – Tensor Rewrites

Tensor optimizations addressing the ops in basic.py.

aesara.tensor.rewriting.basic.broadcast_like(value, template, fgraph, dtype=None)[source]

Return a Variable with the same shape and dtype as the template, filled by broadcasting value through it. value will be cast as necessary.

aesara.tensor.rewriting.basic.encompasses_broadcastable(b1, b2)[source]
  • b1 – The broadcastable attribute of a tensor type.
  • b2 – The broadcastable attribute of a tensor type.

True if the broadcastable patterns b1 and b2 are such that b2 is broadcasted to b1’s shape and not the opposite.

Return type:


aesara.tensor.rewriting.basic.is_an_upcast(type1, type2)[source]

Given two data types (as strings), check if converting to type2 from type1 constitutes an upcast. Differs from aesara.scalar.upcast