“How can I convert a tensor to a numpy array?”
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the `.numpy()` method on the tensor to convert it to a numpy array.
Hey, so, I guess u’re using TensorFlow. To convert a tensor to a numpy array, just use the .numpy() method. Like this:
“`python
tensor = …
numpy_array = tensor.numpy()
“`
That’s it. numpy_array is now a numpy array. Just do this and you’re good to go.