Skip to main content

All Questions

Tagged with
0 votes
0 answers
39 views

Unable to install and use torch through CUDA and VSCode

I have set up Anaconda environment and downloaded CUDA and CuDNN in it. I also have tensorflow installed via conda (not tensorflow-gpu) along with keras and scikit-learn. Once that is done, I am ...
thecuriouscat's user avatar
3 votes
1 answer
1k views

Hashed cross-product transformation in PyTorch

I want to implement a hashed cross product transformation like the one Keras uses: >>> layer = keras.layers.HashedCrossing(num_bins=5, output_mode='one_hot') >>> feat1 = np.array([1, ...
David Davó's user avatar
0 votes
0 answers
2k views

Converting Tensorflow Tensor to PyTorch Tensor

I have been trying to convert a Tensorflow tensor to a Pytorch tensor. I have turned run eagerly to true. I tried: keras_array = K.eval(input_layer) numpy_array = np.array(keras_array) pytorch_tensor ...
BEn's user avatar
  • 7
-1 votes
1 answer
93 views

Library housing CNN shape calculation in a function?

I find myself continually re-implementing the same free function for a convolutional neural network's output shape, given hyperparameters. I am growing tired of re-implementing this function and ...
Intrastellar Explorer's user avatar
0 votes
1 answer
615 views

numpy vs pytorch precision

I've a numpy matrix a defined as: >>> a >>> array([[ 1.920941165 , 0.9518795607, 1.5358781432], [-0.2418292026, 0.0851087409, -0.2760766872], [-0.4161812806, 0....
Ankur Goswami's user avatar
0 votes
3 answers
113 views

Taking mean of all rows in a numpy matrix grouped by values based on another numpy matrix

I have a matrix A of size NXN with float values and another boolean matrix B of size NXN For every row, I need to find the mean of all values in A belonging to indices where True is the corresponding ...
Beyond.Multiverse's user avatar
-1 votes
1 answer
1k views

getting AttributeError: 'numpy.ndarray' object has no attribute 'dim' when converting tensorflow code to pytorch

I was translating my TensorFlow code to PyTorch and suddenly faced this error. What am I doing wrong here? AttributeError Traceback (most recent call last) <...
longwild laptop's user avatar
0 votes
1 answer
318 views

Tensor slicing: tensorflow vs pytorch

I was testing this simple slicing operation in TF and PyTorch which should match in both import tensorflow as tf import numpy as np import torch tf_x = tf.random.uniform((4, 64, 64, 3)) pt_x = torch....
PixelPioneer's user avatar
  • 4,170
-2 votes
1 answer
910 views

tf.bitcast equivalent in pytorch?

This question is different from tf.cast equivalent in pytorch?. bitcast do bitwise reinterpretation(like reinterpret_cast in C++) instead of "safe" type conversion. This operation is useful ...
YouJiacheng's user avatar
0 votes
1 answer
127 views

Gathering entries in a matrix based on a matrix of column indices (tensorflow/numpy)

A little example to demonstrate what I need I have a question about gathering in tensorflow. Let's say I have a tensor of values (that I care about for some reason): test1 = tf.round(5*tf.random....
AndrewJaeyoung's user avatar
0 votes
1 answer
603 views

AttributeError: 'Tensor' object has no attribute 'close'

this is the code I am working with: I searched for a similiar error do i need to change the .close() ? Can anyone help please?
Victoria Grech's user avatar
0 votes
1 answer
422 views

torch dataset error -- 'numpy.int32' is not callable

I'm preparing a set of medical imaging volumes and segmentation masks to be input into a multi-label segmentation neural network for training. I am recieving the following error message when I attempt ...
Christian Thorson's user avatar
0 votes
1 answer
749 views

Pytorch/Tensorflow: Compute gradient of Mixture of Gaussians log density

I have a mixture of three Gaussians and would like to compute the gradient of the log-density using Pytorch or Tensorflow. How can I do that? from numpy import eye, log from scipy.stats import ...
Euler_Salter's user avatar
  • 3,581
0 votes
1 answer
214 views

How to load huge time series windows dataset without memory errors?

I want to convert a typical time series dataset of about 1 million lines into 100-item windows with 50% overlap. Note that it's a multivariate one, so for example given 8 features and 1000 windows ...
civy's user avatar
  • 423
0 votes
2 answers
660 views

Match pytorch scatter output in tensorflow

How can I do the same operation in tensorflow? tensor = np.random.RandomState(42).uniform(size=(2, 4, 2)).astype(np.float32) tensor = torch.from_numpy(tensor) index = tensor.max(-1, keepdim=True)[1] ...
michael0196's user avatar
  • 1,637

15 30 50 per page