c++ - TensorFlow, why was python the chosen language? -


i started studying deep learning , other ml techniques, , started searching frameworks simplify process of build net , training it, found tensorflow, having little experience in field, me, seems speed big factor making big ml system more if working deep learning, why python chosen google make tensorflow? wouldn't better make on language can compiled , not interpreted?

what advantages of using python on language c++ machine learning?

the important thing realize tensorflow that, part, the core not written in python: it's written in combination of highly-optimized c++ , cuda (nvidia's language programming gpus). of happens, in turn, using eigen (a high-performance c++ , cuda numerical library) , nvidia's cudnn (a optimized dnn library nvidia gpus, functions such convolutions).

the model tensorflow programmer uses "some language" (most python!) express model. model, written in tensorflow constructs such as:

h1 = tf.nn.relu(tf.matmul(l1, w1) + b1) h2 = ... 

is not executed when python run. instead, what's created dataflow graph says take particular inputs, apply particular operations, supply results inputs other operations, , on. this model executed fast c++ code, , part, data going between operations never copied python code.

then programmer "drives" execution of model pulling on nodes -- training, in python, , serving, in python , in raw c++:

sess.run(eval_results) 

this 1 python (or c++ function call) uses either in-process call c++ or rpc distributed version call c++ tensorflow server tell execute, , copies results.

so, said, let's re-phrase question: why did tensorflow choose python first well-supported language expressing , controlling training of models?

the answer simple: python the comfortable language large range of data scientists , machine learning experts that's easy integrate , have control c++ backend, while being general, widely-used both inside , outside of google, , open source. given basic model of tensorflow, performance of python isn't important, natural fit. it's huge plus numpy makes easy pre-processing in python -- high performance -- before feeding in tensorflow cpu-heavy things.

there's bunch of complexity in expressing model isn't used when executing -- shape inference (e.g., if matmul(a, b), shape of resulting data?) , automatic gradient computation. turns out have been nice able express in python, though think in long term they'll move c++ backend make adding other languages easier.

(the hope, of course, support other languages in future creating , expressing models. it's quite straightforward run inference using several other languages -- c++ works now, facebook contributed go bindings we're reviewing now, etc.)


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -