Top "Tensor" questions

A tensor is a multi-dimensional array.

How to print the value of a Tensor object in TensorFlow?

I have been using the introductory example of matrix multiplication in TensorFlow. matrix1 = tf.constant([[3., 3.]]) matrix2 = tf.constant([[2.],[2.]]) product = tf.…

python tensorflow tensor
Keras input explanation: input_shape, units, batch_size, dim, etc

For any Keras layer (Layer class), can someone explain how to understand the difference between input_shape, units, dim, etc.? …

neural-network deep-learning keras keras-layer tensor
How does the "view" method work in PyTorch?

I am confused about the method view() in the following code snippet. class Net(nn.Module): def __init__(self): super(…

python memory pytorch torch tensor
Best way to save a trained model in PyTorch?

I was looking for alternative ways to save a trained model in PyTorch. So far, I have found two alternatives. …

python serialization deep-learning pytorch tensor
PyTorch: How to get the shape of a Tensor as a list of int

In numpy, V.shape gives a tuple of ints of dimensions of V. In tensorflow V.get_shape().as_list() …

python pytorch tensor
How to get the dimensions of a tensor (in TensorFlow) at graph construction time?

I am trying an Op that is not behaving as expected. graph = tf.Graph() with graph.as_default(): train_dataset = …

python tensorflow deep-learning tensor
Pytorch reshape tensor dimension

For example, I have 1D vector with dimension (5). I would like to reshape it into 2D matrix (1,5). Here is how …

python numpy deep-learning pytorch tensor
tf.shape() get wrong shape in tensorflow

I define a tensor like this: x = tf.get_variable("x", [100]) But when I try to print shape of tensor : …

python python-3.x tensorflow tensor
AttributeError: 'Tensor' object has no attribute 'numpy'

How can I fix this error I downloaded this code from GitHub. predicted_id = tf.multinomial(tf.exp(predictions), num_…

python numpy tensorflow attributeerror tensor
Torch sum a tensor along an axis

ipdb> outputs.size() torch.Size([10, 100]) ipdb> print sum(outputs,0).size(),sum(outputs,1).size(),sum(outputs,2).size() (100L,) (100L,) (100…

python sum pytorch torch tensor