Dataset.fromSpec() fails with "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

Hello,

I am trying to run the following code in a python script:

c3.Dataset.fromSpec(
    spec=c3.TensorSpec(
                  flattenedData= output.reshape(-1),
                  shape= [len(output_index), 1],
                  axes= ['rows', 'features'],
                  indices= {0: output_index, 1: ['output']}
         )
    )

With the following toy data:
output : np.array([0.15587243, 0.63674573, 1.45041811, 2.60113433, 0.15587243]) output_index: ['0','1','2','3','4']

The code fails with the following error:

"Error executing command: /usr/local/share/c3/condaEnvs/ItInPreMan/a457925/py-survival-py3/bin/python /tmp/LifelinesMLPipe_process7624541058629527561.py
Traceback (most recent call last):
File “/tmp/LifelinesMLPipe_process7624541058629527561.py”, line 1736, in
_c3_result = process(this = _c3_inputs.get(‘this’),input = _c3_inputs.get(‘input’))
File “/tmp/LifelinesMLPipe_process7624541058629527561.py”, line 1728, in process
indices= {0: output_index, 1: [‘output’]}
File “Z6b5fbc2c7836b98862c698e584c29c86Mfb7fc5028fc73623722376cfcedf8d71.ThinTypeSystemBase”, line 61, in native_fn
File “”, line 111, in fromSpec
File “”, line 16, in validate
File “”, line 60, in flattenedData
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
"

However a very similar code run in the console works just fine:

Dataset.fromSpec(
    	spec=TensorSpec.make({
                  flattenedData: [0.15587243, 0.63674573, 1.45041811, 2.60113433, 0.15587243],
                  shape: [5, 1],
                  axes: ['rows', 'features'],
                  indices: {0: ['0','1','2','3','4'], 1: ['output']}
})

What am I doing wrong ?

Ciao Alberto,

flattenedData= output.reshape(-1).tolist()

should fix this