📜  Python – tensorflow.math.ndtri()

📅  最后修改于: 2022-05-13 01:54:40.621000             🧑  作者: Mango

Python – tensorflow.math.ndtri()

TensorFlow 是由谷歌设计的开源Python库,用于开发机器学习模型和深度学习神经网络。 ndtri()用于查找标准正态的分位数。

示例 1:

Python3
# Importing the library
import tensorflow as tf
  
# Initializing the input tensor
a = tf.constant([.2, .5, .7, 1], dtype = tf.float64)
  
# Printing the input tensor
print('Input: ', a)
  
# Calculating result
res = tf.math.ndtri(x = a)
  
# Printing the result
print('Result: ', res)


Python3
# importing the library
import tensorflow as tf
  
# Initializing the input tensor
a = tf.constant([-.1, -.2, -.5, .5, .2, .1], dtype = tf.float64)
  
# Printing the input tensor
print('Input: ', a)
  
# Calculating result
res = tf.math.ndtri(x = a)
  
# Printing the result
print('Result: ', res)


输出:

Input:  tf.Tensor([0.2 0.5 0.7 1. ], shape=(4, ), dtype=float64)
Result:  tf.Tensor([-0.84162123  0.          0.52440051         inf], shape=(4, ), dtype=float64)

示例 2:

Python3

# importing the library
import tensorflow as tf
  
# Initializing the input tensor
a = tf.constant([-.1, -.2, -.5, .5, .2, .1], dtype = tf.float64)
  
# Printing the input tensor
print('Input: ', a)
  
# Calculating result
res = tf.math.ndtri(x = a)
  
# Printing the result
print('Result: ', res)

输出:

Input:  tf.Tensor([-0.1 -0.2 -0.5  0.5  0.2  0.1], shape=(6, ), dtype=float64)
Result:  tf.Tensor([       -inf        -inf        -inf  0.         -0.84162123 -1.28155157], shape=(6, ), dtype=float64)