Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
SparseConvNet
Commits
954223a2
Commit
954223a2
authored
Sep 25, 2018
by
Benjamin Thomas Graham
Browse files
make SCN proper submodule
parent
19aca522
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
53 additions
and
53 deletions
+53
-53
setup.py
setup.py
+2
-2
sparseconvnet/averagePooling.py
sparseconvnet/averagePooling.py
+3
-3
sparseconvnet/batchNormalization.py
sparseconvnet/batchNormalization.py
+3
-3
sparseconvnet/convolution.py
sparseconvnet/convolution.py
+3
-3
sparseconvnet/deconvolution.py
sparseconvnet/deconvolution.py
+3
-3
sparseconvnet/fullConvolution.py
sparseconvnet/fullConvolution.py
+3
-3
sparseconvnet/ioLayers.py
sparseconvnet/ioLayers.py
+9
-9
sparseconvnet/maxPooling.py
sparseconvnet/maxPooling.py
+3
-3
sparseconvnet/metadata.py
sparseconvnet/metadata.py
+2
-2
sparseconvnet/networkInNetwork.py
sparseconvnet/networkInNetwork.py
+4
-4
sparseconvnet/permutohedralSubmanifoldConvolution.py
sparseconvnet/permutohedralSubmanifoldConvolution.py
+3
-3
sparseconvnet/randomizedStrideConvolution.py
sparseconvnet/randomizedStrideConvolution.py
+3
-3
sparseconvnet/randomizedStrideMaxPooling.py
sparseconvnet/randomizedStrideMaxPooling.py
+3
-3
sparseconvnet/sparseToDense.py
sparseconvnet/sparseToDense.py
+3
-3
sparseconvnet/submanifoldConvolution.py
sparseconvnet/submanifoldConvolution.py
+3
-3
sparseconvnet/unPooling.py
sparseconvnet/unPooling.py
+3
-3
No files found.
setup.py
View file @
954223a2
...
@@ -23,13 +23,13 @@ setup(
...
@@ -23,13 +23,13 @@ setup(
url
=
'https://github.com/facebookresearch/SparseConvNet'
,
url
=
'https://github.com/facebookresearch/SparseConvNet'
,
packages
=
[
'sparseconvnet'
,
'sparseconvnet.SCN'
],
packages
=
[
'sparseconvnet'
,
'sparseconvnet.SCN'
],
ext_modules
=
[
ext_modules
=
[
CUDAExtension
(
'sparseconvnet
_
SCN'
,
CUDAExtension
(
'sparseconvnet
.
SCN'
,
[
[
'sparseconvnet/SCN/cuda.cu'
,
'sparseconvnet/SCN/sparseconvnet_cuda.cpp'
,
'sparseconvnet/SCN/pybind.cpp'
],
'sparseconvnet/SCN/cuda.cu'
,
'sparseconvnet/SCN/sparseconvnet_cuda.cpp'
,
'sparseconvnet/SCN/pybind.cpp'
],
include_dirs
=
[
conda_include_dir
,
this_dir
+
'/sparseconvnet/SCN/'
],
include_dirs
=
[
conda_include_dir
,
this_dir
+
'/sparseconvnet/SCN/'
],
extra_compile_args
=
extra
)
extra_compile_args
=
extra
)
if
torch
.
cuda
.
is_available
()
else
if
torch
.
cuda
.
is_available
()
else
CppExtension
(
'sparseconvnet
_
SCN'
,
CppExtension
(
'sparseconvnet
.
SCN'
,
[
'sparseconvnet/SCN/pybind.cpp'
,
'sparseconvnet/SCN/sparseconvnet_cpu.cpp'
],
[
'sparseconvnet/SCN/pybind.cpp'
,
'sparseconvnet/SCN/sparseconvnet_cpu.cpp'
],
include_dirs
=
[
conda_include_dir
,
this_dir
+
'/sparseconvnet/SCN/'
],
include_dirs
=
[
conda_include_dir
,
this_dir
+
'/sparseconvnet/SCN/'
],
extra_compile_args
=
extra
[
'cxx'
])],
extra_compile_args
=
extra
[
'cxx'
])],
...
...
sparseconvnet/averagePooling.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
_
SCN
import
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
from
torch.nn
import
Module
from
.utils
import
*
from
.utils
import
*
...
@@ -82,7 +82,7 @@ class AveragePoolingFunction(Function):
...
@@ -82,7 +82,7 @@ class AveragePoolingFunction(Function):
ctx
.
nFeaturesToDrop
=
nFeaturesToDrop
ctx
.
nFeaturesToDrop
=
nFeaturesToDrop
output_features
=
input_features
.
new
()
output_features
=
input_features
.
new
()
sparseconvnet
_
SCN
.
AveragePooling_updateOutput
(
sparseconvnet
.
SCN
.
AveragePooling_updateOutput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
pool_size
,
pool_size
,
...
@@ -109,7 +109,7 @@ class AveragePoolingFunction(Function):
...
@@ -109,7 +109,7 @@ class AveragePoolingFunction(Function):
pool_size
,
\
pool_size
,
\
pool_stride
=
ctx
.
saved_tensors
pool_stride
=
ctx
.
saved_tensors
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
sparseconvnet
_
SCN
.
AveragePooling_updateGradInput
(
sparseconvnet
.
SCN
.
AveragePooling_updateGradInput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
pool_size
,
pool_size
,
...
...
sparseconvnet/batchNormalization.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
_
SCN
import
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
,
Parameter
from
torch.nn
import
Module
,
Parameter
from
.utils
import
*
from
.utils
import
*
...
@@ -107,7 +107,7 @@ class BatchNormalizationFunction(Function):
...
@@ -107,7 +107,7 @@ class BatchNormalizationFunction(Function):
output_features
=
input_features
.
new
()
output_features
=
input_features
.
new
()
saveMean
=
input_features
.
new
().
resize_
(
ctx
.
nPlanes
)
saveMean
=
input_features
.
new
().
resize_
(
ctx
.
nPlanes
)
saveInvStd
=
runningMean
.
clone
().
resize_
(
ctx
.
nPlanes
)
saveInvStd
=
runningMean
.
clone
().
resize_
(
ctx
.
nPlanes
)
sparseconvnet
_
SCN
.
BatchNormalization_updateOutput
(
sparseconvnet
.
SCN
.
BatchNormalization_updateOutput
(
input_features
,
input_features
,
output_features
,
output_features
,
saveMean
,
saveMean
,
...
@@ -144,7 +144,7 @@ class BatchNormalizationFunction(Function):
...
@@ -144,7 +144,7 @@ class BatchNormalizationFunction(Function):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_bias
=
torch
.
zeros_like
(
bias
)
grad_bias
=
torch
.
zeros_like
(
bias
)
sparseconvnet
_
SCN
.
BatchNormalization_backward
(
sparseconvnet
.
SCN
.
BatchNormalization_backward
(
input_features
,
input_features
,
grad_input
,
grad_input
,
output_features
,
output_features
,
...
...
sparseconvnet/convolution.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
,
sparseconvnet
_
SCN
import
sparseconvnet
,
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
,
Parameter
from
torch.nn
import
Module
,
Parameter
from
.utils
import
*
from
.utils
import
*
...
@@ -91,7 +91,7 @@ class ConvolutionFunction(Function):
...
@@ -91,7 +91,7 @@ class ConvolutionFunction(Function):
filter_size
,
filter_size
,
filter_stride
)
filter_stride
)
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
_
SCN
.
Convolution_updateOutput
(
sparseconvnet
.
SCN
.
Convolution_updateOutput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
filter_size
,
filter_size
,
...
@@ -110,7 +110,7 @@ class ConvolutionFunction(Function):
...
@@ -110,7 +110,7 @@ class ConvolutionFunction(Function):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_bias
=
torch
.
zeros_like
(
bias
)
grad_bias
=
torch
.
zeros_like
(
bias
)
sparseconvnet
_
SCN
.
Convolution_backward
(
sparseconvnet
.
SCN
.
Convolution_backward
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
filter_size
,
filter_size
,
...
...
sparseconvnet/deconvolution.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
,
sparseconvnet
_
SCN
import
sparseconvnet
,
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
,
Parameter
from
torch.nn
import
Module
,
Parameter
from
.utils
import
*
from
.utils
import
*
...
@@ -105,7 +105,7 @@ class DeconvolutionFunction(Function):
...
@@ -105,7 +105,7 @@ class DeconvolutionFunction(Function):
ctx
.
dimension
=
dimension
ctx
.
dimension
=
dimension
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
_
SCN
.
Deconvolution_updateOutput
(
sparseconvnet
.
SCN
.
Deconvolution_updateOutput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
filter_size
,
filter_size
,
...
@@ -139,7 +139,7 @@ class DeconvolutionFunction(Function):
...
@@ -139,7 +139,7 @@ class DeconvolutionFunction(Function):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_bias
=
torch
.
zeros_like
(
bias
)
grad_bias
=
torch
.
zeros_like
(
bias
)
sparseconvnet
_
SCN
.
Deconvolution_backward
(
sparseconvnet
.
SCN
.
Deconvolution_backward
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
filter_size
,
filter_size
,
...
...
sparseconvnet/fullConvolution.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
,
sparseconvnet
_
SCN
import
sparseconvnet
,
sparseconvnet
.
SCN
from
torch.autograd
import
Function
,
Variable
from
torch.autograd
import
Function
,
Variable
from
torch.nn
import
Module
,
Parameter
from
torch.nn
import
Module
,
Parameter
from
.utils
import
*
from
.utils
import
*
...
@@ -115,7 +115,7 @@ class FullConvolutionFunction(Function):
...
@@ -115,7 +115,7 @@ class FullConvolutionFunction(Function):
filter_size
,
filter_size
,
filter_stride
)
filter_stride
)
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
_
SCN
.
FullConvolution_updateOutput
(
sparseconvnet
.
SCN
.
FullConvolution_updateOutput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
filter_size
,
filter_size
,
...
@@ -134,7 +134,7 @@ class FullConvolutionFunction(Function):
...
@@ -134,7 +134,7 @@ class FullConvolutionFunction(Function):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_bias
=
torch
.
zeros_like
(
bias
)
grad_bias
=
torch
.
zeros_like
(
bias
)
sparseconvnet
_
SCN
.
FullConvolution_backward
(
sparseconvnet
.
SCN
.
FullConvolution_backward
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
filter_size
,
filter_size
,
...
...
sparseconvnet/ioLayers.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
_
SCN
import
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
,
Parameter
from
torch.nn
import
Module
,
Parameter
from
.utils
import
*
from
.utils
import
*
...
@@ -165,7 +165,7 @@ class InputLayerFunction(Function):
...
@@ -165,7 +165,7 @@ class InputLayerFunction(Function):
output_features
=
input_features
.
new
()
output_features
=
input_features
.
new
()
ctx
.
dimension
=
dimension
ctx
.
dimension
=
dimension
ctx
.
metadata_
=
metadata
ctx
.
metadata_
=
metadata
sparseconvnet
_
SCN
.
InputLayer_updateOutput
(
sparseconvnet
.
SCN
.
InputLayer_updateOutput
(
metadata
,
metadata
,
spatial_size
,
spatial_size
,
coords
,
coords
,
...
@@ -179,7 +179,7 @@ class InputLayerFunction(Function):
...
@@ -179,7 +179,7 @@ class InputLayerFunction(Function):
@
staticmethod
@
staticmethod
def
backward
(
ctx
,
grad_output
):
def
backward
(
ctx
,
grad_output
):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
sparseconvnet
_
SCN
.
InputLayer_updateGradInput
(
sparseconvnet
.
SCN
.
InputLayer_updateGradInput
(
ctx
.
metadata_
,
ctx
.
metadata_
,
grad_input
,
grad_input
,
grad_output
.
contiguous
())
grad_output
.
contiguous
())
...
@@ -196,7 +196,7 @@ class OutputLayerFunction(Function):
...
@@ -196,7 +196,7 @@ class OutputLayerFunction(Function):
output_features
=
input_features
.
new
()
output_features
=
input_features
.
new
()
ctx
.
metadata_
=
metadata
ctx
.
metadata_
=
metadata
ctx
.
dimension
=
dimension
ctx
.
dimension
=
dimension
sparseconvnet
_
SCN
.
OutputLayer_updateOutput
(
sparseconvnet
.
SCN
.
OutputLayer_updateOutput
(
metadata
,
metadata
,
input_features
.
contiguous
(),
input_features
.
contiguous
(),
output_features
output_features
...
@@ -207,7 +207,7 @@ class OutputLayerFunction(Function):
...
@@ -207,7 +207,7 @@ class OutputLayerFunction(Function):
def
backward
(
ctx
,
grad_output
):
def
backward
(
ctx
,
grad_output
):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
grad_output
=
grad_output
.
contiguous
()
grad_output
=
grad_output
.
contiguous
()
sparseconvnet
_
SCN
.
OutputLayer_updateGradInput
(
sparseconvnet
.
SCN
.
OutputLayer_updateGradInput
(
ctx
.
metadata_
,
ctx
.
metadata_
,
grad_input
,
grad_input
,
grad_output
.
contiguous
())
grad_output
.
contiguous
())
...
@@ -227,7 +227,7 @@ class BLInputLayerFunction(Function):
...
@@ -227,7 +227,7 @@ class BLInputLayerFunction(Function):
output_features
=
input_features
.
new
()
output_features
=
input_features
.
new
()
ctx
.
metadata_
=
metadata
ctx
.
metadata_
=
metadata
ctx
.
dimension
=
dimension
ctx
.
dimension
=
dimension
sparseconvnet
_
SCN
.
BLInputLayer_updateOutput
(
sparseconvnet
.
SCN
.
BLInputLayer_updateOutput
(
metadata
,
metadata
,
spatial_size
,
spatial_size
,
coords
,
coords
,
...
@@ -240,7 +240,7 @@ class BLInputLayerFunction(Function):
...
@@ -240,7 +240,7 @@ class BLInputLayerFunction(Function):
@
staticmethod
@
staticmethod
def
backward
(
ctx
,
grad_output
):
def
backward
(
ctx
,
grad_output
):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
sparseconvnet
_
SCN
.
BLInputLayer_updateGradInput
(
sparseconvnet
.
SCN
.
BLInputLayer_updateGradInput
(
ctx
.
metadata_
,
ctx
.
metadata_
,
grad_input
,
grad_input
,
grad_output
.
contiguous
())
grad_output
.
contiguous
())
...
@@ -257,7 +257,7 @@ class BLOutputLayerFunction(Function):
...
@@ -257,7 +257,7 @@ class BLOutputLayerFunction(Function):
output_features
=
input_features
.
new
()
output_features
=
input_features
.
new
()
ctx
.
metadata_
=
metadata
ctx
.
metadata_
=
metadata
ctx
.
dimension
=
dimension
ctx
.
dimension
=
dimension
sparseconvnet
_
SCN
.
BLOutputLayer_updateOutput
(
sparseconvnet
.
SCN
.
BLOutputLayer_updateOutput
(
metadata
,
metadata
,
input_features
.
contiguous
(),
input_features
.
contiguous
(),
output_features
output_features
...
@@ -267,7 +267,7 @@ class BLOutputLayerFunction(Function):
...
@@ -267,7 +267,7 @@ class BLOutputLayerFunction(Function):
@
staticmethod
@
staticmethod
def
backward
(
ctx
,
grad_output
):
def
backward
(
ctx
,
grad_output
):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
sparseconvnet
_
SCN
.
BLOutputLayer_updateGradInput
(
sparseconvnet
.
SCN
.
BLOutputLayer_updateGradInput
(
ctx
.
metadata_
,
ctx
.
metadata_
,
grad_input
,
grad_input
,
grad_output
.
contiguous
())
grad_output
.
contiguous
())
...
...
sparseconvnet/maxPooling.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
_
SCN
import
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
from
torch.nn
import
Module
from
.utils
import
*
from
.utils
import
*
...
@@ -27,7 +27,7 @@ class MaxPoolingFunction(Function):
...
@@ -27,7 +27,7 @@ class MaxPoolingFunction(Function):
ctx
.
dimension
=
dimension
ctx
.
dimension
=
dimension
ctx
.
nFeaturesToDrop
=
nFeaturesToDrop
ctx
.
nFeaturesToDrop
=
nFeaturesToDrop
output_features
=
input_features
.
new
()
output_features
=
input_features
.
new
()
sparseconvnet
_
SCN
.
MaxPooling_updateOutput
(
sparseconvnet
.
SCN
.
MaxPooling_updateOutput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
pool_size
,
pool_size
,
...
@@ -54,7 +54,7 @@ class MaxPoolingFunction(Function):
...
@@ -54,7 +54,7 @@ class MaxPoolingFunction(Function):
pool_size
,
\
pool_size
,
\
pool_stride
=
ctx
.
saved_tensors
pool_stride
=
ctx
.
saved_tensors
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
sparseconvnet
_
SCN
.
MaxPooling_updateGradInput
(
sparseconvnet
.
SCN
.
MaxPooling_updateGradInput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
pool_size
,
pool_size
,
...
...
sparseconvnet/metadata.py
View file @
954223a2
...
@@ -11,7 +11,7 @@ all coexist within the same MetaData object as long as each spatial size
...
@@ -11,7 +11,7 @@ all coexist within the same MetaData object as long as each spatial size
only occurs once.
only occurs once.
"""
"""
import
sparseconvnet
_
SCN
import
sparseconvnet
.
SCN
def
Metadata
(
dim
):
def
Metadata
(
dim
):
return
getattr
(
sparseconvnet
_
SCN
,
'Metadata_%d'
%
dim
)()
return
getattr
(
sparseconvnet
.
SCN
,
'Metadata_%d'
%
dim
)()
sparseconvnet/networkInNetwork.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
,
sparseconvnet
_
SCN
import
sparseconvnet
,
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
,
Parameter
from
torch.nn
import
Module
,
Parameter
from
.utils
import
*
from
.utils
import
*
...
@@ -24,7 +24,7 @@ class NetworkInNetworkFunction(Function):
...
@@ -24,7 +24,7 @@ class NetworkInNetworkFunction(Function):
weight
,
weight
,
bias
)
bias
)
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
_
SCN
.
NetworkInNetwork_updateOutput
(
sparseconvnet
.
SCN
.
NetworkInNetwork_updateOutput
(
input_features
,
input_features
,
output_features
,
output_features
,
weight
,
weight
,
...
@@ -44,11 +44,11 @@ class NetworkInNetworkFunction(Function):
...
@@ -44,11 +44,11 @@ class NetworkInNetworkFunction(Function):
grad_bias
=
None
grad_bias
=
None
else
:
else
:
grad_bias
=
torch
.
zeros_like
(
bias
)
grad_bias
=
torch
.
zeros_like
(
bias
)
sparseconvnet
_
SCN
.
NetworkInNetwork_updateGradInput
(
sparseconvnet
.
SCN
.
NetworkInNetwork_updateGradInput
(
grad_input
,
grad_input
,
grad_output
,
grad_output
,
weight
)
weight
)
sparseconvnet
_
SCN
.
NetworkInNetwork_accGradParameters
(
sparseconvnet
.
SCN
.
NetworkInNetwork_accGradParameters
(
input_features
,
input_features
,
grad_output
,
grad_output
,
grad_weight
,
grad_weight
,
...
...
sparseconvnet/permutohedralSubmanifoldConvolution.py
View file @
954223a2
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
import
sparseconvnet
import
sparseconvnet
_
SCN
import
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
,
Parameter
from
torch.nn
import
Module
,
Parameter
from
.utils
import
*
from
.utils
import
*
...
@@ -82,7 +82,7 @@ class PermutohedralSubmanifoldConvolutionFunction(Function):
...
@@ -82,7 +82,7 @@ class PermutohedralSubmanifoldConvolutionFunction(Function):
bias
)
bias
)
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
_
SCN
.
PermutohedralSubmanifoldConvolution_updateOutput
(
sparseconvnet
.
SCN
.
PermutohedralSubmanifoldConvolution_updateOutput
(
spatial_size
,
spatial_size
,
input_metadata
,
input_metadata
,
input_features
,
input_features
,
...
@@ -98,7 +98,7 @@ class PermutohedralSubmanifoldConvolutionFunction(Function):
...
@@ -98,7 +98,7 @@ class PermutohedralSubmanifoldConvolutionFunction(Function):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_bias
=
torch
.
zeros_like
(
bias
)
grad_bias
=
torch
.
zeros_like
(
bias
)
sparseconvnet
_
SCN
.
PermutohedralSubmanifoldConvolution_backward
(
sparseconvnet
.
SCN
.
PermutohedralSubmanifoldConvolution_backward
(
spatial_size
,
spatial_size
,
ctx
.
input_metadata
,
ctx
.
input_metadata
,
input_features
,
input_features
,
...
...
sparseconvnet/randomizedStrideConvolution.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
,
sparseconvnet
_
SCN
import
sparseconvnet
,
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
,
Parameter
from
torch.nn
import
Module
,
Parameter
from
.utils
import
*
from
.utils
import
*
...
@@ -104,7 +104,7 @@ class RandomizedStrideConvolutionFunction(Function):
...
@@ -104,7 +104,7 @@ class RandomizedStrideConvolutionFunction(Function):
filter_size
,
filter_size
,
filter_stride
)
filter_stride
)
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
_
SCN
.
RandomizedStrideConvolution_updateOutput
(
sparseconvnet
.
SCN
.
RandomizedStrideConvolution_updateOutput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
filter_size
,
filter_size
,
...
@@ -124,7 +124,7 @@ class RandomizedStrideConvolutionFunction(Function):
...
@@ -124,7 +124,7 @@ class RandomizedStrideConvolutionFunction(Function):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_bias
=
torch
.
zeros_like
(
bias
)
grad_bias
=
torch
.
zeros_like
(
bias
)
sparseconvnet
_
SCN
.
RandomizedStrideConvolution_backward
(
sparseconvnet
.
SCN
.
RandomizedStrideConvolution_backward
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
filter_size
,
filter_size
,
...
...
sparseconvnet/randomizedStrideMaxPooling.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
_
SCN
import
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
from
torch.nn
import
Module
from
.utils
import
*
from
.utils
import
*
...
@@ -27,7 +27,7 @@ class RandomizedStrideMaxPoolingFunction(Function):
...
@@ -27,7 +27,7 @@ class RandomizedStrideMaxPoolingFunction(Function):
ctx
.
dimension
=
dimension
ctx
.
dimension
=
dimension
ctx
.
nFeaturesToDrop
=
nFeaturesToDrop
ctx
.
nFeaturesToDrop
=
nFeaturesToDrop
output_features
=
input_features
.
new
()
output_features
=
input_features
.
new
()
sparseconvnet
_
SCN
.
RandomizedStrideMaxPooling_updateOutput
(
sparseconvnet
.
SCN
.
RandomizedStrideMaxPooling_updateOutput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
pool_size
,
pool_size
,
...
@@ -54,7 +54,7 @@ class RandomizedStrideMaxPoolingFunction(Function):
...
@@ -54,7 +54,7 @@ class RandomizedStrideMaxPoolingFunction(Function):
pool_size
,
\
pool_size
,
\
pool_stride
=
ctx
.
saved_tensors
pool_stride
=
ctx
.
saved_tensors
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
sparseconvnet
_
SCN
.
RandomizedStrideMaxPooling_updateGradInput
(
sparseconvnet
.
SCN
.
RandomizedStrideMaxPooling_updateGradInput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
pool_size
,
pool_size
,
...
...
sparseconvnet/sparseToDense.py
View file @
954223a2
...
@@ -15,7 +15,7 @@ Parameters:
...
@@ -15,7 +15,7 @@ Parameters:
dimension : of the input field,
dimension : of the input field,
"""
"""
import
sparseconvnet
_
SCN
import
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
from
torch.nn
import
Module
from
.utils
import
*
from
.utils
import
*
...
@@ -35,7 +35,7 @@ class SparseToDenseFunction(Function):
...
@@ -35,7 +35,7 @@ class SparseToDenseFunction(Function):
ctx
.
dimension
=
dimension
ctx
.
dimension
=
dimension
ctx
.
save_for_backward
(
input_features
,
spatial_size
)
ctx
.
save_for_backward
(
input_features
,
spatial_size
)
output
=
input_features
.
new
()
output
=
input_features
.
new
()
sparseconvnet
_
SCN
.
SparseToDense_updateOutput
(
sparseconvnet
.
SCN
.
SparseToDense_updateOutput
(
spatial_size
,
spatial_size
,
input_metadata
,
input_metadata
,
input_features
,
input_features
,
...
@@ -47,7 +47,7 @@ class SparseToDenseFunction(Function):
...
@@ -47,7 +47,7 @@ class SparseToDenseFunction(Function):
def
backward
(
ctx
,
grad_output
):
def
backward
(
ctx
,
grad_output
):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
input_features
,
spatial_size
=
ctx
.
saved_tensors
input_features
,
spatial_size
=
ctx
.
saved_tensors
sparseconvnet
_
SCN
.
SparseToDense_updateGradInput
(
sparseconvnet
.
SCN
.
SparseToDense_updateGradInput
(
spatial_size
,
spatial_size
,
ctx
.
input_metadata
,
ctx
.
input_metadata
,
input_features
,
input_features
,
...
...
sparseconvnet/submanifoldConvolution.py
View file @
954223a2
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
# 'SubmanifoldConvolution == SubmanifoldConvolution'
# 'SubmanifoldConvolution == SubmanifoldConvolution'
import
sparseconvnet
import
sparseconvnet
import
sparseconvnet
_
SCN
import
sparseconvnet
.
SCN
from
torch.autograd
import
Function
from
torch.autograd
import
Function
from
torch.nn
import
Module
,
Parameter
from
torch.nn
import
Module
,
Parameter
from
.utils
import
*
from
.utils
import
*
...
@@ -84,7 +84,7 @@ class SubmanifoldConvolutionFunction(Function):
...
@@ -84,7 +84,7 @@ class SubmanifoldConvolutionFunction(Function):
filter_size
)
filter_size
)
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
.
forward_pass_multiplyAdd_count
+=
\
sparseconvnet
_
SCN
.
SubmanifoldConvolution_updateOutput
(
sparseconvnet
.
SCN
.
SubmanifoldConvolution_updateOutput
(
spatial_size
,
spatial_size
,
filter_size
,
filter_size
,
input_metadata
,
input_metadata
,
...
@@ -101,7 +101,7 @@ class SubmanifoldConvolutionFunction(Function):
...
@@ -101,7 +101,7 @@ class SubmanifoldConvolutionFunction(Function):
grad_input
=
grad_output
.
new
()
grad_input
=
grad_output
.
new
()
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_weight
=
torch
.
zeros_like
(
weight
)
grad_bias
=
torch
.
zeros_like
(
bias
)
grad_bias
=
torch
.
zeros_like
(
bias
)
sparseconvnet
_
SCN
.
SubmanifoldConvolution_backward
(
sparseconvnet
.
SCN
.
SubmanifoldConvolution_backward
(
spatial_size
,
spatial_size
,
filter_size
,
filter_size
,
ctx
.
input_metadata
,
ctx
.
input_metadata
,
...
...
sparseconvnet/unPooling.py
View file @
954223a2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# This source code is licensed under the license found in the
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
sparseconvnet
_
SCN
import
sparseconvnet
.
SCN
from
torch.autograd
import
Function
,
Variable
from
torch.autograd
import
Function
,
Variable
from
torch.nn
import
Module
from
torch.nn
import
Module
from
.utils
import
*
from
.utils
import
*
...
@@ -31,7 +31,7 @@ class UnPoolingFunction(Function):
...
@@ -31,7 +31,7 @@ class UnPoolingFunction(Function):
ctx
.
pool_stride
=
pool_stride
ctx
.
pool_stride
=
pool_stride
ctx
.
nFeaturesToDrop
=
nFeaturesToDrop
ctx
.
nFeaturesToDrop
=
nFeaturesToDrop
output_features
=
input_features
.
new
()
output_features
=
input_features
.
new
()
sparseconvnet
_
SCN
.
UnPooling_updateOutput
(
sparseconvnet
.
SCN
.
UnPooling_updateOutput
(
input_spatial_size
,
input_spatial_size
,
output_spatial_size
,
output_spatial_size
,
pool_size
,
pool_size
,
...
@@ -45,7 +45,7 @@ class UnPoolingFunction(Function):
...
@@ -45,7 +45,7 @@ class UnPoolingFunction(Function):
@
staticmethod
@
staticmethod
def
backward
(
ctx
,
grad_output
):
def
backward
(
ctx
,
grad_output
):
grad_input
=
Variable
(
grad_output
.
data
.
new
())
grad_input
=
Variable
(
grad_output
.
data
.
new
())
sparseconvnet
_
SCN
.
UnPooling_updateGradInput
(
sparseconvnet
.
SCN
.
UnPooling_updateGradInput
(
ctx
.
input_spatial_size
,
ctx
.
input_spatial_size
,
ctx
.
output_spatial_size
,
ctx
.
output_spatial_size
,
ctx
.
pool_size
,
ctx
.
pool_size
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment