Answers for "create tf tensor from numpy array"

5

tf tensor from numpy

tf.convert_to_tensor(my_np_array, dtype=tf.float32)
Posted by: Guest on July-14-2020
-1

convert numpy array to tensor

import numpy as np
import torch

numpy_array = np.array([1,3,5])
tensor_array = torch.from_numpy(numpy_array)
Posted by: Guest on July-23-2021

Python Answers by Framework

Browse Popular Code Answers by Language