Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

torch.nan_to_num

>>> x = torch.tensor([float('nan'), float('inf'), -float('inf'), 3.14])
>>> torch.nan_to_num(x)
tensor([ 0.0000e+00,  3.4028e+38, -3.4028e+38,  3.1400e+00])
>>> torch.nan_to_num(x, nan=2.0)
tensor([ 2.0000e+00,  3.4028e+38, -3.4028e+38,  3.1400e+00])
>>> torch.nan_to_num(x, nan=2.0, posinf=1.0)
tensor([ 2.0000e+00,  1.0000e+00, -3.4028e+38,  3.1400e+00])
Comment

PREVIOUS NEXT
Code Example
Python :: python replace negative infinity 
Python :: pandas fill missing index values 
Python :: pandas mean of n columns 
Python :: dumps function in json python 
Python :: fetch image url discord py 
Python :: remove duplicates from list python keep order 
Python :: winsound python 
Python :: python types of loops 
Python :: create list of dictionaries from list of list python 
Python :: Python Generators with a Loop 
Python :: program to demonstrate encapsulation in python 
Python :: insertion sort 
Python :: keras name model 
Python :: pahtlib join path 
Python :: image data generator keras with tf.data.Data.from_generator 
Python :: python tex box 
Python :: Send Fetch Post With Data Using Body 
Python :: how to add array and array in python 
Python :: password protected cmd python 
Python :: Python enumerate Using enumerate() 
Python :: json payload python function 
Python :: Accessing elements from a Python Nested Dictionary 
Python :: time zone in python 
Python :: Delete All Rows In Table Django 
Python :: www.pd.date_range 
Python :: how to specify symbol in matplotlib 
Python :: TypeError: method() takes 1 positional argument but 2 were given 
Python :: how to write user input to a file in python 
Python :: extract directory python 
Python :: logging store info to different files 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =