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