Commit c0c43218 by Ting PAN

Normalize the API view of vm packages

Summary:
This commit enforces all the vm packages to take api/core structure
to adapt to the more complex future developments.
1 parent ae4d6834
Showing with 326 additions and 190 deletions
......@@ -8,20 +8,27 @@
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
"""A fast open framework for deep learning."""
from __future__ import absolute_import as _absolute_import
from __future__ import division as _division
from __future__ import print_function as _print_function
from dragon.vm.caffe.net import Net
from dragon.vm.caffe.net_spec import layers
from dragon.vm.caffe.net_spec import NetSpec
from dragon.vm.caffe.net_spec import params
from dragon.vm.caffe.net_spec import to_proto
from dragon.vm.caffe.solver import AdamSolver
from dragon.vm.caffe.solver import NesterovSolver
from dragon.vm.caffe.solver import RMSPropSolver
from dragon.vm.caffe.solver import SGDSolver
# Classes
from dragon.vm.caffe.core.net import Net
from dragon.vm.caffe.core.net_spec import NetSpec
from dragon.vm.caffe.core.solver import AdamSolver
from dragon.vm.caffe.core.solver import NesterovSolver
from dragon.vm.caffe.core.solver import RMSPropSolver
from dragon.vm.caffe.core.solver import SGDSolver
# Functions
from dragon.vm.caffe.core.net_spec import to_proto
# Attributes
from dragon.vm.caffe.core.net_spec import layers
from dragon.vm.caffe.core.net_spec import params
__all__ = [_s for _s in dir() if not _s.startswith('_')]
# Aliases
Layer = object
......
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
......@@ -20,7 +20,7 @@ from dragon.core.autograph.tensor import TensorRef
from dragon.core.eager import context as eager_context
from dragon.core.framework import context
from dragon.core.util import logging
from dragon.vm.caffe.proto import caffe_pb2
from dragon.vm.caffe.core.proto import caffe_pb2
class Layer(object):
......
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from dragon.vm.caffe.core.layers.common import Accuracy
from dragon.vm.caffe.core.layers.common import ArgMax
from dragon.vm.caffe.core.layers.common import BatchNorm
from dragon.vm.caffe.core.layers.common import Concat
from dragon.vm.caffe.core.layers.common import Crop
from dragon.vm.caffe.core.layers.common import Eltwise
from dragon.vm.caffe.core.layers.common import Flatten
from dragon.vm.caffe.core.layers.common import InnerProduct
from dragon.vm.caffe.core.layers.common import Input
from dragon.vm.caffe.core.layers.common import Normalize
from dragon.vm.caffe.core.layers.common import Permute
from dragon.vm.caffe.core.layers.common import Python
from dragon.vm.caffe.core.layers.common import Reduction
from dragon.vm.caffe.core.layers.common import Reshape
from dragon.vm.caffe.core.layers.common import Scale
from dragon.vm.caffe.core.layers.common import Slice
from dragon.vm.caffe.core.layers.common import Softmax
from dragon.vm.caffe.core.layers.common import StopGradient
from dragon.vm.caffe.core.layers.common import Tile
from dragon.vm.caffe.core.layers.data import Data
from dragon.vm.caffe.core.layers.loss import EuclideanLoss
from dragon.vm.caffe.core.layers.loss import SigmoidCrossEntropyLoss
from dragon.vm.caffe.core.layers.loss import SmoothL1Loss
from dragon.vm.caffe.core.layers.loss import SoftmaxWithLoss
from dragon.vm.caffe.core.layers.neuron import Dropout
from dragon.vm.caffe.core.layers.neuron import ELU
from dragon.vm.caffe.core.layers.neuron import Power
from dragon.vm.caffe.core.layers.neuron import PReLU
from dragon.vm.caffe.core.layers.neuron import ReLU
from dragon.vm.caffe.core.layers.neuron import Sigmoid
from dragon.vm.caffe.core.layers.neuron import TanH
from dragon.vm.caffe.core.layers.vision import Convolution
from dragon.vm.caffe.core.layers.vision import Deconvolution
from dragon.vm.caffe.core.layers.vision import LRN
from dragon.vm.caffe.core.layers.vision import Pooling
from dragon.vm.caffe.core.layers.vision import ROIAlign
from dragon.vm.caffe.core.layers.vision import ROIPooling
__all__ = [_s for _s in dir() if not _s.startswith('_')]
......@@ -8,7 +8,7 @@
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
"""The common layers."""
"""Common layers."""
from __future__ import absolute_import
from __future__ import division
......@@ -23,7 +23,7 @@ from dragon.core.ops import framework_ops
from dragon.core.ops import math_ops
from dragon.core.ops import metric_ops
from dragon.core.ops import normalization_ops
from dragon.vm.caffe.layer import Layer
from dragon.vm.caffe.core.layer import Layer
class Accuracy(Layer):
......@@ -62,7 +62,7 @@ class Accuracy(Layer):
class ArgMax(Layer):
r"""Compute the indices of maximum elements along the given axis.
r"""Compute the index of maximum elements along the given axis.
Examples:
......@@ -72,7 +72,6 @@ class ArgMax(Layer):
bottom: "ip2"
top: "cls"
argmax_param {
top_k: 1
axis: 1
}
}
......@@ -83,11 +82,9 @@ class ArgMax(Layer):
def __init__(self, layer_param):
super(ArgMax, self).__init__(layer_param)
param = layer_param.argmax_param
self.arguments = {
'top_k': param.top_k,
'axis': param.axis,
'keep_dims': True,
}
if param.top_k != 1:
raise ValueError('Top-k argmax is not supported.')
self.arguments = {'axis': param.axis, 'keep_dims': True}
def __call__(self, bottom):
return array_ops.argmax(bottom, **self.arguments)
......
......@@ -8,7 +8,7 @@
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
"""The data layers."""
"""Data layers."""
from __future__ import absolute_import
from __future__ import division
......@@ -19,7 +19,7 @@ from dragon.core.io.kpl_record import KPLRecordDataset
from dragon.core.ops import array_ops
from dragon.core.ops import framework_ops
from dragon.utils import vision
from dragon.vm.caffe.layer import Layer
from dragon.vm.caffe.core.layer import Layer
class _DataPlugin(object):
......
......@@ -8,14 +8,14 @@
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
"""The loss layers."""
"""Loss layers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from dragon.core.ops import loss_ops
from dragon.vm.caffe.layer import Layer
from dragon.vm.caffe.core.layer import Layer
class EuclideanLoss(Layer):
......
......@@ -8,7 +8,7 @@
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
"""The neuron layers."""
"""Neuron layers."""
from __future__ import absolute_import
from __future__ import division
......@@ -16,7 +16,7 @@ from __future__ import print_function
from dragon.core.ops import activation_ops
from dragon.core.ops import math_ops
from dragon.vm.caffe.layer import Layer
from dragon.vm.caffe.core.layer import Layer
class Dropout(Layer):
......
......@@ -8,7 +8,7 @@
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
"""The vision layers."""
"""Vision layers."""
from __future__ import absolute_import
from __future__ import division
......@@ -16,7 +16,7 @@ from __future__ import print_function
from dragon.core.ops import normalization_ops
from dragon.core.ops import vision_ops
from dragon.vm.caffe.layer import Layer
from dragon.vm.caffe.core.layer import Layer
class Convolution(Layer):
......
......@@ -24,8 +24,8 @@ from dragon.core.framework import context
from dragon.core.framework import workspace
from dragon.core.util import nest
from dragon.core.util import serialization
from dragon.vm.caffe import layers as layer_factory
from dragon.vm.caffe.proto import caffe_pb2
from dragon.vm.caffe.core import layers as layer_factory
from dragon.vm.caffe.core.proto import caffe_pb2
class Blob(object):
......@@ -38,6 +38,7 @@ class Net(object):
"""The base net class to connect layers.
This class accepts a network file, and an optional parameter file.
Besides, a phase tag is required to compute gradients or not:
```python
......
......@@ -12,6 +12,7 @@
# <https://github.com/BVLC/caffe/blob/master/python/caffe/net_spec.py>
#
# ------------------------------------------------------------
"""Net proto maker."""
from __future__ import absolute_import
from __future__ import division
......@@ -19,7 +20,7 @@ from __future__ import print_function
import collections
from dragon.vm.caffe.proto import caffe_pb2
from dragon.vm.caffe.core.proto import caffe_pb2
def param_name_dict():
......
......@@ -23,8 +23,8 @@ from dragon.core.training.rmsprop import RMSprop
from dragon.core.training.sgd import SGD
from dragon.core.training.sgd import Nesterov
from dragon.core.util import logging
from dragon.vm.caffe.net import Net
from dragon.vm.caffe.proto import caffe_pb2
from dragon.vm.caffe.core.net import Net
from dragon.vm.caffe.core.proto import caffe_pb2
class Solver(object):
......
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from dragon.vm.caffe.layers.common import Accuracy
from dragon.vm.caffe.layers.common import ArgMax
from dragon.vm.caffe.layers.common import BatchNorm
from dragon.vm.caffe.layers.common import Concat
from dragon.vm.caffe.layers.common import Crop
from dragon.vm.caffe.layers.common import Eltwise
from dragon.vm.caffe.layers.common import Flatten
from dragon.vm.caffe.layers.common import InnerProduct
from dragon.vm.caffe.layers.common import Input
from dragon.vm.caffe.layers.common import Normalize
from dragon.vm.caffe.layers.common import Permute
from dragon.vm.caffe.layers.common import Python
from dragon.vm.caffe.layers.common import Reduction
from dragon.vm.caffe.layers.common import Reshape
from dragon.vm.caffe.layers.common import Scale
from dragon.vm.caffe.layers.common import Slice
from dragon.vm.caffe.layers.common import Softmax
from dragon.vm.caffe.layers.common import StopGradient
from dragon.vm.caffe.layers.common import Tile
from dragon.vm.caffe.layers.data import Data
from dragon.vm.caffe.layers.loss import EuclideanLoss
from dragon.vm.caffe.layers.loss import SigmoidCrossEntropyLoss
from dragon.vm.caffe.layers.loss import SmoothL1Loss
from dragon.vm.caffe.layers.loss import SoftmaxWithLoss
from dragon.vm.caffe.layers.neuron import Dropout
from dragon.vm.caffe.layers.neuron import ELU
from dragon.vm.caffe.layers.neuron import Power
from dragon.vm.caffe.layers.neuron import PReLU
from dragon.vm.caffe.layers.neuron import ReLU
from dragon.vm.caffe.layers.neuron import Sigmoid
from dragon.vm.caffe.layers.neuron import TanH
from dragon.vm.caffe.layers.vision import Convolution
from dragon.vm.caffe.layers.vision import Deconvolution
from dragon.vm.caffe.layers.vision import LRN
from dragon.vm.caffe.layers.vision import Pooling
from dragon.vm.caffe.layers.vision import ROIAlign
from dragon.vm.caffe.layers.vision import ROIPooling
__all__ = [_s for _s in dir() if not _s.startswith('_')]
......@@ -8,6 +8,8 @@
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
"""A library containing both highly optimized building blocks
and an execution engine for data pre-processing in deep learning applications."""
from __future__ import absolute_import as _absolute_import
from __future__ import division as _division
......@@ -16,7 +18,7 @@ from __future__ import print_function as _print_function
import os as _os
import sys as _sys
# Public API
# Modules
from dragon.vm.dali._api import ops
# Classes
......@@ -47,7 +49,7 @@ from dragon.vm.dali.core.types import UINT16
from dragon.vm.dali.core.types import UINT32
from dragon.vm.dali.core.types import UINT64
# API-Module
# Attributes
_API_MODULE = ops
_current_module = _sys.modules[__name__]
_api_dir = _os.path.dirname(_os.path.dirname(_API_MODULE.__file__))
......@@ -55,3 +57,4 @@ if not hasattr(_current_module, '__path__'):
__path__ = [_api_dir]
elif _api_dir not in __path__:
__path__.append(_api_dir)
__all__ = [_s for _s in dir() if not _s.startswith('_')]
......@@ -13,12 +13,11 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from dragon.vm.dali.core import iterator
from dragon.vm.torch import cpp
from dragon.vm.torch.tensor import Tensor
from dragon.vm import dali
from dragon.vm import torch
class DALIGenericIterator(iterator.Iterator):
class DALIGenericIterator(dali.Iterator):
"""The general DALI iterator for ``vm.torch`` package."""
def __init__(self, pipeline):
......@@ -54,12 +53,12 @@ class DALIGenericIterator(iterator.Iterator):
@staticmethod
def new_device(device_type, device_index):
"""Return a new device abstraction."""
return cpp.device(device_type, device_index)
return torch.device(device_type, device_index)
@staticmethod
def new_tensor(shape, dtype, device):
"""Return a new tensor abstraction."""
return Tensor(*shape, dtype=dtype, device=device)
return torch.Tensor(*shape, dtype=dtype, device=device)
def __next__(self):
"""Return the next batch of data.
......
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
RUN \
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
......@@ -8,6 +9,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
unzip \
ssh \
vim \
libudev-dev \
libz-dev \
libnuma-dev \
libprotobuf-dev \
protobuf-compiler \
......@@ -17,7 +20,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python3-tk \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir --upgrade setuptools wheel -i https://pypi.tuna.tsinghua.edu.cn/simple && \
RUN \
pip3 install --no-cache-dir --upgrade setuptools wheel -i https://pypi.tuna.tsinghua.edu.cn/simple && \
pip3 install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple \
numpy \
protobuf \
......@@ -25,11 +29,13 @@ RUN pip3 install --no-cache-dir --upgrade setuptools wheel -i https://pypi.tuna.
opencv-python \
Pillow
RUN git clone --recursive https://github.com/seetaresearch/Dragon.git && \
mv Dragon/third_party/* /opt && rm -rf Dragon
RUN \
git clone --recursive https://github.com/seetaresearch/dragon.git && \
mv dragon/third_party/* /opt && rm -rf dragon
RUN git clone https://github.com/seetaresearch/Dragon.git && \
cd Dragon/dragon && mkdir build && cd build && \
RUN \
git clone https://github.com/seetaresearch/dragon.git && \
cd dragon/dragon && mkdir build && cd build && \
cmake .. \
-DTHIRD_PARTY_DIR=/opt \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
......
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04
RUN rm /etc/apt/sources.list.d/cuda.list && rm /etc/apt/sources.list.d/nvidia-ml.list && \
RUN \
rm /etc/apt/sources.list.d/cuda.list && \
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
......@@ -9,6 +10,8 @@ RUN rm /etc/apt/sources.list.d/cuda.list && rm /etc/apt/sources.list.d/nvidia-ml
unzip \
ssh \
vim \
libudev-dev \
libz-dev \
libnuma-dev \
libprotobuf-dev \
protobuf-compiler \
......@@ -16,9 +19,12 @@ RUN rm /etc/apt/sources.list.d/cuda.list && rm /etc/apt/sources.list.d/nvidia-ml
python3-dev \
python3-pyqt4 \
python3-tk \
libnccl2 \
libnccl-dev \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir --upgrade setuptools wheel -i https://pypi.tuna.tsinghua.edu.cn/simple && \
RUN \
pip3 install --no-cache-dir --upgrade setuptools wheel -i https://pypi.tuna.tsinghua.edu.cn/simple && \
pip3 install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple \
numpy \
protobuf \
......@@ -26,13 +32,15 @@ RUN pip3 install --no-cache-dir --upgrade setuptools wheel -i https://pypi.tuna.
opencv-python \
Pillow
RUN git clone --recursive https://github.com/seetaresearch/Dragon.git && \
mv Dragon/third_party/* /opt && rm -rf Dragon
RUN \
git clone --recursive https://github.com/seetaresearch/dragon.git && \
mv dragon/third_party/* /opt && rm -rf dragon
RUN cd /opt/mpi && bash build.sh && rm -rf src *.gz && cp bin/mpirun /usr/bin
RUN git clone https://github.com/seetaresearch/Dragon.git && \
cd Dragon/dragon && mkdir build && cd build && \
RUN \
git clone https://github.com/seetaresearch/dragon.git && \
cd dragon/dragon && mkdir build && cd build && \
cmake .. \
-DTHIRD_PARTY_DIR=/opt \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
......
......@@ -791,9 +791,11 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = ../../../Dragon/include \
../../../Dragon/src \
../../../Dragon/modules
INPUT = ../../../dragon/core \
../../../dragon/modules \
../../../dragon/onnx \
../../../dragon/operators \
../../../dragon/utils
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
......
......@@ -10,15 +10,12 @@ vm.caffe.layers
: Compute the top-k accuracy.
`class ArgMax <layers/ArgMax.html>`_
: Compute the indices of maximum elements along the given axis.
: Compute the index of maximum elements along the given axis.
`class BatchNorm <layers/BatchNorm.html>`_
: Apply the batch normalization.
`[Ioffe & Szegedy, 2015] <https://arxiv.org/abs/1502.03167>`_.
`class Cast <layers/Cast.html>`_
: Cast the data type of input.
`class Concat <layers/Concat.html>`_
: Concatenate the inputs along the given axis.
......@@ -45,9 +42,6 @@ vm.caffe.layers
: Apply the exponential linear unit.
`[Clevert et.al, 2015] <https://arxiv.org/abs/1511.07289>`_.
`class ExpandDims <layers/ExpandDims.html>`_
: Expand a new dimension with size **1** at the given axis.
`class EuclideanLoss <layers/EuclideanLoss.html>`_
: Compute the element-wise squared error.
......
Accuracy
========
.. autoclass:: dragon.vm.caffe.layers.Accuracy
.. autoclass:: dragon.vm.caffe.core.layers.Accuracy
.. raw:: html
......
ArgMax
======
.. autoclass:: dragon.vm.caffe.layers.ArgMax
.. autoclass:: dragon.vm.caffe.core.layers.ArgMax
.. raw:: html
......
BatchNorm
=========
.. autoclass:: dragon.vm.caffe.layers.BatchNorm
.. autoclass:: dragon.vm.caffe.core.layers.BatchNorm
.. raw:: html
......
Concat
======
.. autoclass:: dragon.vm.caffe.layers.Concat
.. autoclass:: dragon.vm.caffe.core.layers.Concat
.. raw:: html
......
Convolution
===========
.. autoclass:: dragon.vm.caffe.layers.Convolution
.. autoclass:: dragon.vm.caffe.core.layers.Convolution
.. raw:: html
......
Crop
====
.. autoclass:: dragon.vm.caffe.layers.Crop
.. autoclass:: dragon.vm.caffe.core.layers.Crop
.. raw:: html
......
Data
====
.. autoclass:: dragon.vm.caffe.layers.Data
.. autoclass:: dragon.vm.caffe.core.layers.Data
.. raw:: html
......
Deconvolution
=============
.. autoclass:: dragon.vm.caffe.layers.Deconvolution
.. autoclass:: dragon.vm.caffe.core.layers.Deconvolution
.. raw:: html
......
Dropout
=======
.. autoclass:: dragon.vm.caffe.layers.Dropout
.. autoclass:: dragon.vm.caffe.core.layers.Dropout
.. raw:: html
......
ELU
===
.. autoclass:: dragon.vm.caffe.layers.ELU
.. autoclass:: dragon.vm.caffe.core.layers.ELU
.. raw:: html
......
Eltwise
========
.. autoclass:: dragon.vm.caffe.layers.Eltwise
.. autoclass:: dragon.vm.caffe.core.layers.Eltwise
.. raw:: html
......
EuclideanLoss
=============
.. autoclass:: dragon.vm.caffe.layers.EuclideanLoss
.. autoclass:: dragon.vm.caffe.core.layers.EuclideanLoss
.. raw:: html
......
Flatten
========
.. autoclass:: dragon.vm.caffe.layers.Flatten
.. autoclass:: dragon.vm.caffe.core.layers.Flatten
.. raw:: html
......
InnerProduct
============
.. autoclass:: dragon.vm.caffe.layers.InnerProduct
.. autoclass:: dragon.vm.caffe.core.layers.InnerProduct
.. raw:: html
......
Input
=====
.. autoclass:: dragon.vm.caffe.layers.Input
.. autoclass:: dragon.vm.caffe.core.layers.Input
.. raw:: html
......
LRN
====
.. autoclass:: dragon.vm.caffe.layers.LRN
.. autoclass:: dragon.vm.caffe.core.layers.LRN
.. raw:: html
......
Normalize
=========
.. autoclass:: dragon.vm.caffe.layers.Normalize
.. autoclass:: dragon.vm.caffe.core.layers.Normalize
.. raw:: html
......
PReLU
=====
.. autoclass:: dragon.vm.caffe.layers.PReLU
.. autoclass:: dragon.vm.caffe.core.layers.PReLU
.. raw:: html
......
Permute
=======
.. autoclass:: dragon.vm.caffe.layers.Permute
.. autoclass:: dragon.vm.caffe.core.layers.Permute
.. raw:: html
......
Pooling
=======
.. autoclass:: dragon.vm.caffe.layers.Pooling
.. autoclass:: dragon.vm.caffe.core.layers.Pooling
.. raw:: html
......
Power
=====
.. autoclass:: dragon.vm.caffe.layers.Power
.. autoclass:: dragon.vm.caffe.core.layers.Power
.. raw:: html
......
Python
======
.. autoclass:: dragon.vm.caffe.layers.Python
.. autoclass:: dragon.vm.caffe.core.layers.Python
.. raw:: html
......
ROIAlign
========
.. autoclass:: dragon.vm.caffe.layers.ROIAlign
.. autoclass:: dragon.vm.caffe.core.layers.ROIAlign
.. raw:: html
......
ROIPooling
==========
.. autoclass:: dragon.vm.caffe.layers.ROIPooling
.. autoclass:: dragon.vm.caffe.core.layers.ROIPooling
.. raw:: html
......
ReLU
====
.. autoclass:: dragon.vm.caffe.layers.ReLU
.. autoclass:: dragon.vm.caffe.core.layers.ReLU
.. raw:: html
......
Reduction
=========
.. autoclass:: dragon.vm.caffe.layers.Reduction
.. autoclass:: dragon.vm.caffe.core.layers.Reduction
.. raw:: html
......
Reshape
=======
.. autoclass:: dragon.vm.caffe.layers.Reshape
.. autoclass:: dragon.vm.caffe.core.layers.Reshape
.. raw:: html
......
Scale
=====
.. autoclass:: dragon.vm.caffe.layers.Scale
.. autoclass:: dragon.vm.caffe.core.layers.Scale
.. raw:: html
......
Sigmoid
=======
.. autoclass:: dragon.vm.caffe.layers.Sigmoid
.. autoclass:: dragon.vm.caffe.core.layers.Sigmoid
.. raw:: html
......
SigmoidCrossEntropyLoss
=======================
.. autoclass:: dragon.vm.caffe.layers.SigmoidCrossEntropyLoss
.. autoclass:: dragon.vm.caffe.core.layers.SigmoidCrossEntropyLoss
.. raw:: html
......
SmoothL1Loss
============
.. autoclass:: dragon.vm.caffe.layers.SmoothL1Loss
.. autoclass:: dragon.vm.caffe.core.layers.SmoothL1Loss
.. raw:: html
......
Softmax
=======
.. autoclass:: dragon.vm.caffe.layers.Softmax
.. autoclass:: dragon.vm.caffe.core.layers.Softmax
.. raw:: html
......
SoftmaxWithLoss
===============
.. autoclass:: dragon.vm.caffe.layers.SoftmaxWithLoss
.. autoclass:: dragon.vm.caffe.core.layers.SoftmaxWithLoss
.. raw:: html
......
StopGradient
============
.. autoclass:: dragon.vm.caffe.layers.StopGradient
.. autoclass:: dragon.vm.caffe.core.layers.StopGradient
.. raw:: html
......
TanH
====
.. autoclass:: dragon.vm.caffe.layers.TanH
.. autoclass:: dragon.vm.caffe.core.layers.TanH
.. raw:: html
......
Tile
====
.. autoclass:: dragon.vm.caffe.layers.Tile
.. autoclass:: dragon.vm.caffe.core.layers.Tile
.. raw:: html
......
......@@ -91,6 +91,7 @@ html_sidebars = {
'tensorrt/**': ['localtoc.html'],
'torch': ['localtoc.html'],
'torch/**': ['localtoc.html'],
'torchvision/**': ['localtoc.html'],
'_modules/**': ['localtoc.html'],
'search': ['localtoc.html'],
}
......
......@@ -88,7 +88,7 @@ dragon
: Context-manager set the graph execution mode.
`index_select(...) <dragon/index_select.html>`_
: Select the elements according to the indices along the given axis.
: Select the elements according to the index along the given axis.
`load_library(...) <dragon/load_library.html>`_
: Load a shared library.
......
......@@ -16,10 +16,10 @@ dragon.math
: Compute the affine transformation along the given axes.
`argmax(...) <math/argmax.html>`_
: Compute the indices of maximum elements along the given axis.
: Compute the index of maximum elements along the given axis.
`argmin(...) <math/argmin.html>`_
: Compute the indices of minimum elements along the given axis.
: Compute the index of minimum elements along the given axis.
`axpby(...) <math/axpby.html>`_
: Compute the element-wise addition from input to output.
......@@ -141,6 +141,9 @@ dragon.math
`tanh(...) <math/tanh.html>`_
: Compute the tanh of input.
`top_k(...) <math/top_k.html>`_
: Return the top-K largest or smallest elements along the given axis.
.. toctree::
:hidden:
......@@ -189,6 +192,7 @@ dragon.math
math/sub
math/sum
math/tanh
math/top_k
.. raw:: html
......
expand
======
top_k
=====
.. autofunction:: dragon.vm.torch.expand
.. autofunction:: dragon.math.top_k
.. raw:: html
<style>
h1:before {
content: "torch.";
content: "dragon.math.";
color: #103d3e;
}
</style>
......@@ -13,7 +13,7 @@ dragon.random
: Return a tensor initialized from the glorot uniform distribution.
`multinomial(...) <random/multinomial.html>`_
: Return a tensor with indices sampled from the multinomial distribution.
: Return a tensor with index sampled from the multinomial distribution.
`normal(...) <random/normal.html>`_
: Return a tensor initialized from the normal distribution.
......
......@@ -113,10 +113,11 @@ PyTorch
* `torch.jit <torch/jit.html>`_
* `torch.nn <torch/nn.html>`_
* `torch.nn.functional <torch/nn/functional.html>`_
* `torch.nn.init <torch/nn/init.html>`_
* `torch.onnx <torch/onnx.html>`_
* `torch.optim <torch/optim.html>`_
* `torch.vision.ops <torch/vision/ops.html>`_
* `torch.utils.dlpack <torch/utils/dlpack.html>`_
* `torchvision.ops <torchvision/ops.html>`_
Integrations
------------
......@@ -275,18 +276,21 @@ Modules
`Module vm.torch.nn.functional <torch/nn/functional.html>`_
: Virtual API for ``torch.nn.functional`` namespace.
`Module vm.torch.nn.init <torch/nn/init.html>`_
: Virtual API for ``torch.nn.init`` namespace.
`Module vm.torch.onnx <torch/onnx.html>`_
: Virtual API for ``torch.onnx`` namespace.
`Module vm.torch.optim <torch/optim.html>`_
: Virtual API for ``torch.optim`` namespace.
`Module vm.torch.vision.ops <torch/vision/ops.html>`_
: Virtual API for ``torch.vision.ops`` namespace.
`Module vm.torch.utils.dlpack <torch/utils/dlpack.html>`_
: Virtual API for ``torch.utils.dlpack`` namespace.
`Module vm.torchvision.ops <torchvision/ops.html>`_
: Virtual API for ``torchvision.ops`` namespace.
.. toctree::
:hidden:
......@@ -329,7 +333,8 @@ Modules
torch/jit
torch/nn
torch/nn/functional
torch/nn/init
torch/onnx
torch/optim
torch/vision/ops
torch/utils/dlpack
torchvision/ops
......@@ -159,7 +159,7 @@ Name Supported Reference
`TfIdfVectorizer`_
`ThresholdedRelu`_
`Tile`_ |v| :func:`dragon.tile`
`TopK`_
`TopK`_ |v| :func:`dragon.math.top_k`
`Transpose`_ |v| :func:`dragon.transpose`
`Unique`_
`Unsqueeze`_ |v| :func:`dragon.unsqueeze`
......
......@@ -46,7 +46,7 @@ vm.tensorflow
: Return a tensor filled with the scalar value.
`gather(...) <tensorflow/gather.html>`_
: Select the elements according to the indices along the given axis.
: Select the elements according to the index along the given axis.
`function(...) <tensorflow/function.html>`_
: Create a callable graph from the python function.
......
......@@ -13,6 +13,9 @@ activations
`exponential(...) <activations/exponential.html>`_
: Apply the exponential activation to input.
`get(...) <activations/get.html>`_
: Return the activation callable by identifier.
`linear(...) <activations/linear.html>`_
: Apply the linear activation to input.
......@@ -38,6 +41,7 @@ activations
activations/elu
activations/exponential
activations/get
activations/linear
activations/relu
activations/selu
......
get
===
.. autofunction:: dragon.vm.tensorflow.keras.activations.get
.. raw:: html
<style>
h1:before {
content: "tf.keras.activations.";
color: #103d3e;
}
</style>
......@@ -36,10 +36,17 @@ initializers
`class Zeros <initializers/Zeros.html>`_
: Fill tensors with zeros.
Functions
---------
`get(...) <initializers/get.html>`_
: Return the initializer callable by identifier.
.. toctree::
:hidden:
initializers/Constant
initializers/get
initializers/GlorotNormal
initializers/GlorotUniform
initializers/Initializer
......
get
===
.. autofunction:: dragon.vm.tensorflow.keras.initializers.get
.. raw:: html
<style>
h1:before {
content: "tf.keras.initializers.";
color: #103d3e;
}
</style>
......@@ -33,6 +33,9 @@ losses
`categorical_crossentropy(...) <losses/categorical_crossentropy.html>`_
: Compute the categorical cross entropy with contiguous targets.
`get(...) <losses/get.html>`_
: Return the loss callable by identifier.
`mean_absolute_error(...) <losses/mean_absolute_error.html>`_
: Compute the reduced element-wise absolute value difference.
......@@ -49,6 +52,7 @@ losses
losses/binary_crossentropy
losses/CategoricalCrossentropy
losses/categorical_crossentropy
losses/get
losses/Loss
losses/MeanAbsoluteError
losses/MeanSquaredError
......
get
===
.. autofunction:: dragon.vm.tensorflow.keras.losses.get
.. raw:: html
<style>
h1:before {
content: "tf.keras.losses.";
color: #103d3e;
}
</style>
......@@ -16,10 +16,10 @@ vm.tensorflow.math
: Compute the element-wise sum on a sequence of inputs.
`argmax(...) <math/argmax.html>`_
: Compute the indices of maximum elements along the given axis.
: Compute the index of maximum elements along the given axis.
`argmin(...) <math/argmin.html>`_
: Compute the indices of minimum elements along the given axis.
: Compute the index of minimum elements along the given axis.
`ceil(...) <math/ceil.html>`_
: Compute the smallest integer not less than input.
......@@ -120,6 +120,9 @@ vm.tensorflow.math
`tanh(...) <math/tanh.html>`_
: Compute the tanh of input.
`top_k(...) <math/top_k.html>`_
: Return the top-K largest elements along the last axis.
.. toctree::
:hidden:
......@@ -161,6 +164,7 @@ vm.tensorflow.math
math/square
math/subtract
math/tanh
math/top_k
.. raw:: html
......
top_k
=====
.. autofunction:: dragon.vm.tensorflow.math.top_k
.. raw:: html
<style>
h1:before {
content: "tf.math.";
color: #103d3e;
}
</style>
......@@ -77,9 +77,14 @@ vm.tensorflow.nn
`softmax(...) <nn/softmax.html>`_
: Apply the softmax function.
`softmax_cross_entropy_with_logits(...) <nn/softmax_cross_entropy_with_logits.html>`_
: Compute the softmax cross entropy with contiguous labels.
`space_to_depth(...) <nn/space_to_depth.html>`_
: Rearrange blocks of spatial data into depth.
`sparse_softmax_cross_entropy_with_logits(...) <nn/sparse_softmax_cross_entropy_with_logits.html>`_
: Compute the softmax cross entropy with sparse labels.
.. toctree::
:hidden:
......@@ -105,7 +110,9 @@ vm.tensorflow.nn
nn/relu6
nn/selu
nn/softmax
nn/softmax_cross_entropy_with_logits
nn/space_to_depth
nn/sparse_softmax_cross_entropy_with_logits
.. raw:: html
......
softmax_cross_entropy_with_logits
=================================
.. autofunction:: dragon.vm.torch.nn.functional.softmax_cross_entropy_with_logits
.. autofunction:: dragon.vm.tensorflow.nn.softmax_cross_entropy_with_logits
.. raw:: html
<style>
h1:before {
content: "torch.nn.functional.";
content: "tf.nn.";
color: #103d3e;
}
</style>
sparse_softmax_cross_entropy_with_logits
========================================
.. autofunction:: dragon.vm.tensorflow.nn.sparse_softmax_cross_entropy_with_logits
.. raw:: html
<style>
h1:before {
content: "tf.nn.";
color: #103d3e;
}
</style>
......@@ -55,7 +55,7 @@ vm.tensorlayer.layers
Functions
---------
`Input(...) <layer/Input.html>`_
`Input(...) <layers/Input.html>`_
: Create a placeholder as input.
.. toctree::
......
......@@ -40,10 +40,10 @@ vm.torch
: Return a tensor of evenly spaced values within a interval.
`argmax(...) <torch/argmax.html>`_
: Return the indices of maximum elements along the given axis.
: Return the index of maximum elements along the given dimension.
`argmin(...) <torch/argmin.html>`_
: Return the indices of minimum elements along the given axis.
: Return the index of minimum elements along the given dimension.
`axpby(...) <torch/axpby.html>`_
: Compute the element-wise addition from input to output.
......@@ -77,7 +77,7 @@ vm.torch
: Compute the cos of input.
`cumsum(...) <torch/cumsum.html>`_
: Compute the cumulative sum of elements along the given axis.
: Compute the cumulative sum of elements along the given dimension.
`div(...) <torch/div.html>`_
: Compute the element-wise division.
......@@ -91,9 +91,6 @@ vm.torch
`exp(...) <torch/exp.html>`_
: Compute the exponential of input.
`expand(...) <torch/expand.html>`_
: Broadcast input according to given sizes.
`eye(...) <torch/eye.html>`_
: Return a tensor constructed as the identity matrix.
......@@ -134,16 +131,16 @@ vm.torch
: Select the input elements where mask is 1.
`max(...) <torch/max.html>`_
: Compute the max value of elements along the given axis.
: Compute the max value of elements along the given dimension.
`maximum(...) <torch/maximum.html>`_
: Compute the maximum value of inputs.
`mean(...) <torch/mean.html>`_
: Compute the mean value of elements along the given axis.
: Compute the mean value of elements along the given dimension.
`min(...) <torch/min.html>`_
: Compute the min value of elements along the given axis.
: Compute the min value of elements along the given dimension.
`minimum(...) <torch/minimum.html>`_
: Compute the minimum value of inputs.
......@@ -164,7 +161,7 @@ vm.torch
: Compute the element-wise not-equal comparison.
`nonzero(...) <torch/nonzero.html>`_
: Return the indices of non-zero elements.
: Return the index of non-zero elements.
`ones(...) <torch/ones.html>`_
: Return a tensor filled with ones.
......@@ -224,16 +221,13 @@ vm.torch
: Compute the element-wise subtraction.
`sum(...) <torch/sum.html>`_
: Compute the sum value of elements along the given axis.
: Compute the sum value of elements along the given dimension.
`tensor(...) <torch/tensor.html>`_
: Create a tensor initializing the content from data.
`topk(...) <torch/topk.html>`_
: Return the k largest/smallest values and indices along the given axis.
`topk_acc(...) <torch/topk_acc.html>`_
: Compute the top-k accuracy according to the label.
: Return the top-K largest or smallest elements along the given dimension.
`unsqueeze(...) <torch/unsqueeze.html>`_
: Expand the dimensions of input with size 1.
......@@ -273,7 +267,6 @@ vm.torch
torch/enable_grad
torch/eq
torch/exp
torch/expand
torch/eye
torch/floor
torch/from_numpy
......@@ -324,7 +317,6 @@ vm.torch
torch/Tensor_
torch/tensor
torch/topk
torch/topk_acc
torch/unsqueeze
torch/where
torch/zeros_like
......
......@@ -53,6 +53,14 @@ add\_
#####
.. automethod:: dragon.vm.torch.Tensor.add_
argmax
######
.. automethod:: dragon.vm.torch.Tensor.argmax
argmin
######
.. automethod:: dragon.vm.torch.Tensor.argmin
backward
########
.. automethod:: dragon.vm.torch.Tensor.backward
......@@ -409,6 +417,10 @@ sub\_
#####
.. automethod:: dragon.vm.torch.Tensor.sub_
topk
####
.. automethod:: dragon.vm.torch.Tensor.topk
type
####
.. automethod:: dragon.vm.torch.Tensor.type
......@@ -447,6 +459,8 @@ zero\_
.. _torch.abs(...): abs.html
.. _torch.add(...): add.html
.. _torch.argmax(...): argmax.html
.. _torch.argmin(...): argmin.html
.. _torch.bitwise_not(...): bitwise_not.html
.. _torch.bitwise_xor(...): bitwise_xor.html
.. _torch.ceil(...): ceil.html
......@@ -474,6 +488,7 @@ zero\_
.. _torch.sin(...): sin.html
.. _torch.sqrt(...): sqrt.html
.. _torch.sub(...): sub.html
.. _torch.topk(...): topk.html
.. raw:: html
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!