提交 ef854897 authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Thomas Wiecki

Rename theano.tensor.nnet.nnet to theano.tensor.nnet.basic

上级 77835528
.. _libdoc_tensor_nnet_nnet: .. _libdoc_tensor_nnet_basic:
====================================================== ======================================================
:mod:`nnet` -- Ops for neural networks :mod:`basic` -- Basic Ops for neural networks
====================================================== ======================================================
.. module:: theano.tensor.nnet.nnet .. module:: theano.tensor.nnet.basic
:platform: Unix, Windows :platform: Unix, Windows
:synopsis: Ops for neural networks :synopsis: Ops for neural networks
.. moduleauthor:: LISA .. moduleauthor:: LISA
......
...@@ -16,7 +16,7 @@ from theano.graph.fg import FunctionGraph ...@@ -16,7 +16,7 @@ from theano.graph.fg import FunctionGraph
from theano.graph.opt import check_stack_trace from theano.graph.opt import check_stack_trace
from theano.tensor.basic import Argmax from theano.tensor.basic import Argmax
from theano.tensor.elemwise import CAReduce, DimShuffle, Elemwise from theano.tensor.elemwise import CAReduce, DimShuffle, Elemwise
from theano.tensor.nnet.nnet import ( from theano.tensor.nnet.basic import (
CrossentropyCategorical1Hot, CrossentropyCategorical1Hot,
CrossentropyCategorical1HotGrad, CrossentropyCategorical1HotGrad,
CrossentropySoftmax1HotWithBiasDx, CrossentropySoftmax1HotWithBiasDx,
......
...@@ -12,7 +12,7 @@ import numpy as np ...@@ -12,7 +12,7 @@ import numpy as np
import theano import theano
import theano.tensor as tt import theano.tensor as tt
from theano.tensor.nnet.nnet import CrossentropySoftmax1HotWithBiasDx, softmax from theano.tensor.nnet.basic import CrossentropySoftmax1HotWithBiasDx, softmax
from theano.tensor.type import ivector, lscalar, matrix from theano.tensor.type import ivector, lscalar, matrix
......
...@@ -1696,7 +1696,7 @@ class ProfileStats: ...@@ -1696,7 +1696,7 @@ class ProfileStats:
# tip 7 # tip 7
import theano.gpuarray import theano.gpuarray
import theano.tensor.signal.pool as pool import theano.tensor.signal.pool as pool
from theano.tensor.nnet.nnet import LogSoftmax from theano.tensor.nnet.basic import LogSoftmax
for (fgraph, a) in self.apply_time: for (fgraph, a) in self.apply_time:
node = a node = a
......
...@@ -1465,7 +1465,7 @@ def add_deprecated_configvars(): ...@@ -1465,7 +1465,7 @@ def add_deprecated_configvars():
"warn__argmax_pushdown_bug", "warn__argmax_pushdown_bug",
( (
"Warn if in past version of Theano we generated a bug with the " "Warn if in past version of Theano we generated a bug with the "
"theano.tensor.nnet.nnet.local_argmax_pushdown optimization. " "theano.tensor.nnet.basic.local_argmax_pushdown optimization. "
"Was fixed 27 may 2010" "Was fixed 27 may 2010"
), ),
BoolParam(_warn_default("0.3")), BoolParam(_warn_default("0.3")),
......
...@@ -62,7 +62,7 @@ from theano.tensor.nnet.abstract_conv import ( ...@@ -62,7 +62,7 @@ from theano.tensor.nnet.abstract_conv import (
assert_conv_shape, assert_conv_shape,
get_conv_output_shape, get_conv_output_shape,
) )
from theano.tensor.nnet.nnet import LogSoftmax, SoftmaxGrad from theano.tensor.nnet.basic import LogSoftmax, SoftmaxGrad
from theano.tensor.signal.pool import AveragePoolGrad, MaxPoolGrad, Pool from theano.tensor.signal.pool import AveragePoolGrad, MaxPoolGrad, Pool
......
...@@ -1480,9 +1480,9 @@ def local_gpua_tri(fgraph, op, context_name, inputs, outputs): ...@@ -1480,9 +1480,9 @@ def local_gpua_tri(fgraph, op, context_name, inputs, outputs):
@register_opt("fast_compile") @register_opt("fast_compile")
@op_lifter([theano.tensor.nnet.nnet.CrossentropySoftmaxArgmax1HotWithBias]) @op_lifter([theano.tensor.nnet.basic.CrossentropySoftmaxArgmax1HotWithBias])
@register_opt2( @register_opt2(
[theano.tensor.nnet.nnet.CrossentropySoftmaxArgmax1HotWithBias], "fast_compile" [theano.tensor.nnet.basic.CrossentropySoftmaxArgmax1HotWithBias], "fast_compile"
) )
def local_gpua_crossentropysoftmaxargmax1hotwithbias( def local_gpua_crossentropysoftmaxargmax1hotwithbias(
fgraph, op, context_name, inputs, outputs fgraph, op, context_name, inputs, outputs
...@@ -1491,9 +1491,9 @@ def local_gpua_crossentropysoftmaxargmax1hotwithbias( ...@@ -1491,9 +1491,9 @@ def local_gpua_crossentropysoftmaxargmax1hotwithbias(
@register_opt("fast_compile") @register_opt("fast_compile")
@op_lifter([theano.tensor.nnet.nnet.CrossentropySoftmax1HotWithBiasDx]) @op_lifter([theano.tensor.nnet.basic.CrossentropySoftmax1HotWithBiasDx])
@register_opt2( @register_opt2(
[theano.tensor.nnet.nnet.CrossentropySoftmax1HotWithBiasDx], "fast_compile" [theano.tensor.nnet.basic.CrossentropySoftmax1HotWithBiasDx], "fast_compile"
) )
def local_gpua_crossentropysoftmax1hotwithbiasdx( def local_gpua_crossentropysoftmax1hotwithbiasdx(
fgraph, op, context_name, inputs, outputs fgraph, op, context_name, inputs, outputs
...@@ -1502,22 +1502,22 @@ def local_gpua_crossentropysoftmax1hotwithbiasdx( ...@@ -1502,22 +1502,22 @@ def local_gpua_crossentropysoftmax1hotwithbiasdx(
@register_opt("fast_compile") @register_opt("fast_compile")
@op_lifter([theano.tensor.nnet.nnet.Softmax]) @op_lifter([theano.tensor.nnet.basic.Softmax])
@register_opt2([theano.tensor.nnet.nnet.Softmax], "fast_compile") @register_opt2([theano.tensor.nnet.basic.Softmax], "fast_compile")
def local_gpua_softmax(fgraph, op, context_name, inputs, outputs): def local_gpua_softmax(fgraph, op, context_name, inputs, outputs):
return gpu_softmax return gpu_softmax
@register_opt("fast_compile") @register_opt("fast_compile")
@op_lifter([theano.tensor.nnet.nnet.SoftmaxWithBias]) @op_lifter([theano.tensor.nnet.basic.SoftmaxWithBias])
@register_opt2([theano.tensor.nnet.nnet.SoftmaxWithBias], "fast_compile") @register_opt2([theano.tensor.nnet.basic.SoftmaxWithBias], "fast_compile")
def local_gpua_softmaxwithbias(fgraph, op, context_name, inputs, outputs): def local_gpua_softmaxwithbias(fgraph, op, context_name, inputs, outputs):
return gpu_softmax_with_bias return gpu_softmax_with_bias
@register_opt("fast_compile") @register_opt("fast_compile")
@op_lifter([theano.tensor.nnet.nnet.CrossentropyCategorical1Hot]) @op_lifter([theano.tensor.nnet.basic.CrossentropyCategorical1Hot])
@register_opt2([theano.tensor.nnet.nnet.CrossentropyCategorical1Hot], "fast_compile") @register_opt2([theano.tensor.nnet.basic.CrossentropyCategorical1Hot], "fast_compile")
def local_gpu_crossentropycategorical1hot(fgraph, op, context_name, inputs, outputs): def local_gpu_crossentropycategorical1hot(fgraph, op, context_name, inputs, outputs):
# There is no corresponding GPU Op, but we can express it as: # There is no corresponding GPU Op, but we can express it as:
# coding, one_of_n = inputs # coding, one_of_n = inputs
...@@ -1528,9 +1528,9 @@ def local_gpu_crossentropycategorical1hot(fgraph, op, context_name, inputs, outp ...@@ -1528,9 +1528,9 @@ def local_gpu_crossentropycategorical1hot(fgraph, op, context_name, inputs, outp
@register_opt("fast_compile") @register_opt("fast_compile")
@op_lifter([theano.tensor.nnet.nnet.CrossentropyCategorical1HotGrad]) @op_lifter([theano.tensor.nnet.basic.CrossentropyCategorical1HotGrad])
@register_opt2( @register_opt2(
[theano.tensor.nnet.nnet.CrossentropyCategorical1HotGrad], "fast_compile" [theano.tensor.nnet.basic.CrossentropyCategorical1HotGrad], "fast_compile"
) )
def local_gpu_crossentropycategorical1hotgrad( def local_gpu_crossentropycategorical1hotgrad(
fgraph, op, context_name, inputs, outputs fgraph, op, context_name, inputs, outputs
......
...@@ -57,7 +57,7 @@ from theano.tensor.nlinalg import ( ...@@ -57,7 +57,7 @@ from theano.tensor.nlinalg import (
QRFull, QRFull,
QRIncomplete, QRIncomplete,
) )
from theano.tensor.nnet.nnet import Softmax from theano.tensor.nnet.basic import Softmax
from theano.tensor.nnet.sigm import ScalarSoftplus from theano.tensor.nnet.sigm import ScalarSoftplus
from theano.tensor.opt import MakeVector from theano.tensor.opt import MakeVector
from theano.tensor.slinalg import Cholesky, Solve from theano.tensor.slinalg import Cholesky, Solve
......
...@@ -7,8 +7,7 @@ from theano.tensor.nnet.abstract_conv import ( ...@@ -7,8 +7,7 @@ from theano.tensor.nnet.abstract_conv import (
conv3d, conv3d,
separable_conv2d, separable_conv2d,
) )
from theano.tensor.nnet.bn import batch_normalization from theano.tensor.nnet.basic import (
from theano.tensor.nnet.nnet import (
binary_crossentropy, binary_crossentropy,
categorical_crossentropy, categorical_crossentropy,
confusion_matrix, confusion_matrix,
...@@ -41,6 +40,7 @@ from theano.tensor.nnet.nnet import ( ...@@ -41,6 +40,7 @@ from theano.tensor.nnet.nnet import (
softmax_with_bias, softmax_with_bias,
softsign, softsign,
) )
from theano.tensor.nnet.bn import batch_normalization
from theano.tensor.nnet.sigm import ( from theano.tensor.nnet.sigm import (
hard_sigmoid, hard_sigmoid,
scalar_sigmoid, scalar_sigmoid,
......
...@@ -926,7 +926,7 @@ def local_softmax_with_bias(fgraph, node): ...@@ -926,7 +926,7 @@ def local_softmax_with_bias(fgraph, node):
if sm_bias.type == node.outputs[0].type: if sm_bias.type == node.outputs[0].type:
# This condition is not always true. See the test # This condition is not always true. See the test
# nnet/tests/test_nnet.py:T_SoftmaxWithBias.test_broadcast # nnet/tests/test_basic.py:T_SoftmaxWithBias.test_broadcast
return [sm_bias] return [sm_bias]
...@@ -1672,7 +1672,7 @@ def local_argmax_pushdown(fgraph, node): ...@@ -1672,7 +1672,7 @@ def local_argmax_pushdown(fgraph, node):
) )
): ):
if config.warn__argmax_pushdown_bug: if config.warn__argmax_pushdown_bug:
logging.getLogger("theano.tensor.nnet.nnet").warn( logging.getLogger("theano.tensor.nnet.basic").warn(
"There was a bug in Theano fixed on May 27th, 2010 in this case." "There was a bug in Theano fixed on May 27th, 2010 in this case."
" I.E. when we take the max of a softplus, softmax, exp, " " I.E. when we take the max of a softplus, softmax, exp, "
"log, tanh, sigmoid, softmax_with_bias op, we were doing " "log, tanh, sigmoid, softmax_with_bias op, we were doing "
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论