Skip to content

TNS operator breaks types. #150

@python-processing-unit

Description

@python-processing-unit

According to the specification section 9.1.6:

TNS: TNS(TNS: shape, ANY: value) and TNS: TNS(STR: value) = MUST construct tensors. In the shape form, shape MUST be a one-dimensional tensor of positive INT lengths and the result MUST be filled with value.

In the implementation, however, the TNS(shape, value) constructor in builtins.c determines the tensor's element DeclType via a switch on args[1].type that omits VAL_MAP. As a result, tensors built by TNS([n], fill_map) receive elem_type == TYPE_UNKNOWN even when value is a MAP. Tensor literals compute their elem_type from their elements (so a literal [fill_map, fill_map] has elem_type == TYPE_MAP), and EQ compares tensors' elem_type before deep-comparing contents. This mismatch causes otherwise-identical tensors to compare unequal and makes tests fail (see tests/cases/passing/op-tns-from-shape-map.pre).

Metadata

Metadata

Labels

bugSomething isn't workingpatchRequires a patch version change.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions