Converts a set or algebraic structure to a tensor.