When def _parse_param
from Relay.frontend.from_tensorflow
process a Scaler Constant node, it will convert it into a Constant with shape [1]
, by following codes:
new_array = np.empty([1], dtype=np_array.dtype)
new_array[0] = np_array
self._nodes[name] = [tvm.relay.const(new_array)]
But this conversion often cause dimension mismatch. For example, a Concat
operation has two inputs, one is a Scaler constant node, another is a scaler computed from another computation node. After _parse_param
conversion, the Scaler constant node will have [1]
shape, and the other is still a scaler with no shape. And then the Concat
will fail.
So, can we change the above codes into
self._nodes[name] = [tvm.relay.const(np_array)]