Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get PI in tensorflow?

I could not find any information about mathemtical constants in the Tensorflow API

neither in Basic Math functions nor in Math Ops.

I was able to get it by

import math as m
pi = tf.constant(m.pi)

However, this would mean to include another library, - so I wonder if there is this functionallity for mathemtical constants like pi, or euler already provided inside tensorflow?

like image 541
Kev1n91 Avatar asked Sep 01 '17 07:09

Kev1n91


2 Answers

math is in the Python standard library, not a third-party module.

I don't see why using it is a problem whatsoever.

like image 68
AKX Avatar answered Oct 23 '22 20:10

AKX


As I know NO, and there's a reason for it. If each library define it own pi will be lots of code duplications! You did it right

like image 36
ChaosPredictor Avatar answered Oct 23 '22 20:10

ChaosPredictor