第2章準備
2.1. Data Manipulation2.1 データの操作
In order to get anything done, we need some way to store and manipulate data. Generally, there are two important things we need to do with data: (i) acquire them; and (ii) process them once they are inside the computer. There is no point in acquiring data without some way to store it, so to start, let’s get our hands dirty with -dimensional arrays, which we also call tensors. If you already know the NumPy scientific computing package, this will be a breeze. For all modern deep learning frameworks, the tensor class (
ndarray in MXNet, Tensor in PyTorch and TensorFlow) resembles NumPy’s ndarray, with a few killer features added. First, the tensor class supports automatic differentiation. Second, it leverages GPUs to accelerate numerical computation, whereas NumPy only runs on CPUs. These properties make neural networks both easy to code and fast to run.英語のヒント
何かを成し遂げるには、データを保存し操作する何らかの方法が必要である。一般に、データについてしなければならない大事なことは二つある。(i)データを手に入れること。(ii)コンピュータの中に入ったデータを処理すること。保存する方法もなしにデータを手に入れても意味がないので、まずは次元配列、つまりテンソルとも呼ぶものに実際に手を触れてみよう。科学計算のパッケージNumPyをすでに知っているなら、これは朝飯前である。現代の深層学習フレームワークではどれも、テンソルのクラス(MXNetでは
ndarray、PyTorchとTensorFlowではTensor)は、NumPyのndarrayに似ており、いくつかの強力な機能が加わっている。第一に、テンソルのクラスは自動微分に対応している。第二に、GPUを活用して数値計算を加速する。NumPyはCPUでしか動かない。これらの性質のおかげで、ニューラルネットワークは書きやすく、速く動く。