Vengineerの戯言

人生は短いけど、長いです。人生を楽しみましょう!

Intel nGraph C++ Version公開


2018/2/25(日)のブログにIntel nGraphのC++実装についてをアップしましたが、

C++版、v0.1.0 の rc0/rc1 が公開されました。

追記)、2018.03.21
rc2、v0.1.0が公開されました。

サイトから図を引用します。

https://github.com/NervanaSystems/ngraph/raw/master/doc/sphinx/source/graphics/ngraph-ecosystem.png

現時点では、neon、TensorFlow、MXNet と ONNX からのインポートできるようですね。

CPU版(x86-64)では、Intel MKL-DNN使っています。

Intel TBB、Eigen、OpenMP、Clang、LLVM-5.0 を使っています。

backendは、INTERPRETERとCPU、そして、GPU

そして、Intel Nervana NNP の コード名は、ARGON ?

ざっくり、ソースコード、眺めました。

Pythonコードだと、こんな感じ。basic.py

引用
import numpy as np
import ngraph as ng

shape = [2, 2]
A = ng.parameter(shape, name='A')
B = ng.parameter(shape, name='B')
C = ng.parameter(shape, name='C')
# >>> print(A)
# <Parameter: 'A' (2, 2, float)>

model = (A + B) * C
# >>> print(model)
# <Node: 'Multiply_6'>

runtime = ng.runtime(manager_name='INTERPRETER')
# >>> print(runtime)
# <Runtime: Manager='INTERPRETER'>

computation = runtime.computation(model, A, B, C)
# >>> print(computation)
# <Computation: Multiply_6(A, B, C)>

value_a = np.array([[1, 2], [3, 4]], dtype=np.float32)
value_b = np.array([[5, 6], [7, 8]], dtype=np.float32)
value_c = np.array([[9, 10], [11, 12]], dtype=np.float32)

result = computation(value_a, value_b, value_c)
# >>> print(result)
# [[ 54.  80.]
#  [110. 144.]]
print('Result = ', result)

追記)、2018.03.21
TensorFlow :Build with an XLA plugin to libngraph
TensorFlow r1.3の XLA plugin 対応です。ソースコードをサックと解析したので、資料(39頁)としてまとめました。