Owl API Cheatsheet ================== .. tabularcolumns:: |c|l|l| +-------------------------+-------------------------------------------+---------------------------------------+ | Category | Description [#]_ | Function | +=========================+===========================================+=======================================+ | Element-wise | basics | ``+ - * /`` | | +-------------------------------------------+---------------------------------------+ | | exponential | ``owl.elewise.exp(x)`` | | +-------------------------------------------+---------------------------------------+ | | ln | ``owl.elewise.ln(x)`` | | +-------------------------------------------+---------------------------------------+ | | sigmoid | ``owl.elewise.sigm(x)`` | | +-------------------------------------------+---------------------------------------+ | | sigmoid back | ``owl.elewise.sigm_back(y)`` | | +-------------------------------------------+---------------------------------------+ | | tanh | ``owl.elewise.tanh(x)`` | | +-------------------------------------------+---------------------------------------+ | | tanh back | ``owl.elewise.tanh_back(y)`` | | +-------------------------------------------+---------------------------------------+ | | relu | ``owl.elewise.relu(x)`` | | +-------------------------------------------+---------------------------------------+ | | relu back | ``owl.elewise.relu_back(y, x)`` | +-------------------------+-------------------------------------------+---------------------------------------+ | Matrix | multiplication | ``*`` | | +-------------------------------------------+---------------------------------------+ | | transpose | ``.trans()`` | +-------------------------+-------------------------------------------+---------------------------------------+ | Reduction [#]_ | sum | ``.sum(axis)`` | | +-------------------------------------------+---------------------------------------+ | | max | ``.max(axis)`` | | +-------------------------------------------+---------------------------------------+ | | argmax | ``.argmax(axis)`` | | +-------------------------------------------+---------------------------------------+ | | **count zero** | ``.count_zero()`` | +-------------------------+-------------------------------------------+---------------------------------------+ | Broadcast [#]_ | broadcast | ``+ - * /`` | +-------------------------+-------------------------------------------+---------------------------------------+ | Generator | fill zeros | ``owl.zeros(shape)`` | | +-------------------------------------------+---------------------------------------+ | | fill ones | ``owl.ones(shape)`` | | +-------------------------------------------+---------------------------------------+ | | normal distribution | ``owl.randn(shape, mu, var)`` | | +-------------------------------------------+---------------------------------------+ | | bernoulli distribution | ``owl.randb(shape, prob)`` | +-------------------------+-------------------------------------------+---------------------------------------+ | Shape | reshape | ``.reshape(shape)`` | | +-------------------------------------------+---------------------------------------+ | | slice | ``owl.slice(src, dim, off, count)`` | | +-------------------------------------------+---------------------------------------+ | | concat | ``owl.concat(arrays, dim)`` | +-------------------------+-------------------------------------------+---------------------------------------+ | I/O | **convert to numpy** | ``.to_numpy()`` | | +-------------------------------------------+---------------------------------------+ | | convert from numpy | ``owl.from_numpy(nparr)`` | +-------------------------+-------------------------------------------+---------------------------------------+ | Convnet | convolution (ff/bp/grad) | ``owl.conv.Convolver`` | | +-------------------------------------------+---------------------------------------+ | | pooling (ff/bp) | ``owl.conv.Pooler`` | | +-------------------------------------------+---------------------------------------+ | | lrn (ff/bp) | ``owl.conv.Lrner`` | | +-------------------------------------------+---------------------------------------+ | | softmax | ``owl.conv.softmax(x, op)`` | +-------------------------+-------------------------------------------+---------------------------------------+ | Model & Trainer | neural network definition | ``owl.net.Net`` | | +-------------------------------------------+---------------------------------------+ | | build network from Caffe's config | ``owl.net.CaffeNetBuilder`` | | +-------------------------------------------+---------------------------------------+ | | multi-gpu trainer | ``owl.net.NetTrainer`` | | +-------------------------------------------+---------------------------------------+ | | feature extractor | ``owl.net.FeatureExtractor`` | | +-------------------------------------------+---------------------------------------+ | | multi-view tester | ``owl.net.MultiviewTester`` | +-------------------------+-------------------------------------------+---------------------------------------+ | System | initialize system | ``owl.initialize(argv)`` | | +-------------------------------------------+---------------------------------------+ | | **wait for all laziness to finish** | ``owl.wait_for_all()`` | | +-------------------------------------------+---------------------------------------+ | | create cpu device | ``owl.create_cpu_device()`` | | +-------------------------------------------+---------------------------------------+ | | create gpu device | ``owl.create_gpu_device(id)`` | | +-------------------------------------------+---------------------------------------+ | | choose device to compute | ``owl.set_device(dev)`` | +-------------------------+-------------------------------------------+---------------------------------------+ .. [#] Descriptions of non-lazy operations are in bold text. .. [#] Currently, reduction (``sum``, ``max``, ``argmax``) is only allowed on 2-D matrix along row or column. .. [#] Definition of `broadcast `_. Currently, broadcast is only allowed on 2-D matrix along row or column.