0

Assume there is a list that includes a numpy array such as

import numpy as np 
output = [np.array([[[5.21]],
                    [[2.22]],
                    [[1.10]],
                    [[3.76]]], dtype=np.float32)]

Is there any quick way to extract values from this output list such as

result = [5.21, 2.22, 1.10, 3.76]

many thanks

DaCard
  • 511
  • 4
  • 15

1 Answers1

2

Yes. Try this

result = output[0].reshape(1,-1).flatten().tolist()
Gaurav
  • 1,095
  • 10
  • 19