cell2cell icon indicating copy to clipboard operation
cell2cell copied to clipboard

`c2c.io.read_data.load_tensor` loads NoneType

Open paupaiz opened this issue 2 years ago • 2 comments

Tensor output of c2c.analysis.run_tensor_cell2cell_pipeline works fine but loading it from the .pkl file doesn't Can reproduce this error in the package's colab demo. Screenshot 2023-12-22 at 6 05 59 PM

paupaiz avatar Dec 23 '23 00:12 paupaiz

It looks like you are loading the tensor properly since it prints the InteractionTensor object. However, you get Nonetype for the tensor.factors and tensor.rank, which means you haven't run the decomposition on that object.

It could be because you are saving the tensor before running the decomposition.

earmingol avatar Dec 23 '23 02:12 earmingol

Just checked the google collab and yes, the tensor you are saving is the one without running the decomposition (tensor). The one to save should be the variable tensor2, which includes the outputs of running the pipeline. This happens because in that case we are passing the copy_tensor=True parameter, so the pipeline does not modify the original tensor and outputs a new one instead.

I have now modified the collab to save tensor2 instead. That is, modifying this: c2c.io.export_variable_with_pickle(tensor, output_folder + 'Tensor.pkl') to c2c.io.export_variable_with_pickle(tensor2, output_folder + 'Tensor.pkl')

earmingol avatar Dec 23 '23 12:12 earmingol