Questions tagged [float32]
16 questions
7
votes
1 answer
np.float32 floating point differences between intel MacBook and M1
I have recently upgraded my Intel MacBook Pro 13" to a MacBook Pro 14" with M1 Pro. Been working hard on getting my software to compile and work again. No big issues fortunately, except for floating point problems in some obscure fortran code and in…

pdj
- 169
- 8
4
votes
0 answers
TypeError: You are passing KerasTensor..... when fitting a model
I am trying to finish a project on variational autoencoders (VAE)
I have tried lots of methods and lots of help from the internet but every time I run into a different problem.
Most often it is SHAPE problems, but it can also be like that one:
after…

Tal Haim
- 41
- 3
3
votes
0 answers
Converting from Numpy Array to PyTorch Tensor
Since Numpy array is Float64 by default. How do I convert to PyTorch tensor to give a FLoat32 type and not 64?
I tried torch.from_numpy and it gave a Float64 type.

Lamosh
- 41
- 5
1
vote
1 answer
How to create a PyGLM array of float32 type from a list of python floats
I have this function to modify it:
def buffers_init_pnt() -> None:
global mPoints
global POINTS_VAOID
global POINTS_VBOID
global glmverts_pnt_init
floatlist = []
for item in sphere_nodes:
…

prusso
- 39
- 5
1
vote
1 answer
Three.js - How to fill Float32Array with equal number of points for different geometries
I have a project that loads various models (.obj, can be anything) and generates particles from the geometry position using Float23Array's.
Given the geometries of each model are completely different, this causes the number of particles to change…

jahilldev
- 3,520
- 4
- 35
- 52
1
vote
1 answer
How to convert 0-1 image float array to 0-255 int array
import matplotlib
import numpy as np
photo=plt.imread('Feynman.png')
plt.figure
plt.subplot(121)
plt.imshow(photo)
photo*=255
plt.subplot(122)
plt.imshow(photo)
Plot results in:
Clipping input data to the valid range for imshow with RGB data…

Ravin
- 33
- 1
- 4
0
votes
1 answer
Fast read/unpacking of float32 from int16 in Python
Say I have a Python script which reads some binary data, packed as int16. I want to convert this data to float32 as fast as possible.
Currently I am doing this, per file
data = np.fromfile(fid, 'int16').astype('float32')
This has the unfortunate…

Marcus Therkildsen
- 63
- 1
- 8
0
votes
0 answers
Float values are sometimes altered
When I insert the 667289685 value in a float32 field, ClickHouse round it to 667289660. Why does ClickHouse do that?
My example table
CREATE TABLE mytable (id Int32, valor Float32)
ENGINE = MergeTree PRIMARY KEY (id)
Insert
INSERT INTO mytable…

Nelson Rocadura
- 1
- 1
0
votes
0 answers
OpenCV allowed data types
I am working with OpenCV in Python. I found that working with uint8 and float32 works in OpenCV 4. This question OpenCV Mat element types and their sizes shows some more data types but I got an error when choosing e.g. 64bit float.
If I simply…

Judita
- 13
- 4
0
votes
2 answers
"Input contains NaN, infinity or a value too large for dtype('float32')There are no Nan or blanks in my data set but still wont let me proceed
Keep getting the error 'Input contains NaN, infinity or a value too large for dtype('float32')' when trying to run a random forest regressor model. I've searched my data set and cant see any infinite values or NaN. Any suggestions?
[96] …

Joshua Cunliffe
- 1
- 1
- 1
0
votes
1 answer
Possible bug with inf or too large values?
I'm trying to train a neural network with keras and tesorflow. As usual, I replace -np.inf and np.inf values with np.nan to later run a dropna sequence and clear all that wrong data such as:
Data.replace([np.inf, -np.inf], np.nan, inplace=True)
…

Aurepilous
- 7
- 2
0
votes
0 answers
How to convert (%) sign in float data type or delete it
When I try to read the date from Excel file, I found that
the column called "TOT_SALES" the data type is float64 and all values with % sign.
I want to remove this sign and dividing all values on 100. And at the same time the values in the column in…

Moh Sa
- 1
- 3
0
votes
1 answer
JavaScript Buffer to Float32
I am receiving a Buffer 40 48 f5 c3 3f b4 7a e1 3f 35 c2 8f with the following values, the values are coded as Float32 :
3.14: 0x4048f5c3
1.41: 0x3fb47ae1
0.71: 0x3f35c28f
Can I map the buffer into a json as a row of numbers:
{
value1: 3.14,
…

MeerArtefakt
- 386
- 2
- 6
- 26
0
votes
1 answer
How do I get the results from argmax of [0., 1e-8]?
When I ran below code, I got x=1, y=0
a = np.array([0., 1e-8]).astype('float32')
x = a.argmax()
y = (a+1).argmax()
I already know floating point expression. But, I don't know why I can get x=1, y=0.
I think that overflow or underflow can be…

douner
- 21
- 4
0
votes
1 answer
Change in precision value of numpy float32 while summing up the elements
I have an array and I would like to calculate the sum of the elements column wise (column_sum) and divide the column elements with the column_sum, so that after division, the sum of column elements would be equal to 1.
Code:
import numpy as np
#…

N G
- 1
- 2