提交 b81b3471 authored 作者: kvmanohar22's avatar kvmanohar22

changed numpy imports to one common form

上级 57e81f52
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
import theano import theano
import numpy as N import numpy as np
from theano import tensor as T from theano import tensor as T
from theano.tensor import nnet as NN from theano.tensor import nnet as NN
from six.moves import xrange from six.moves import xrange
...@@ -52,7 +52,7 @@ class RegressionLayer(M.Module): ...@@ -52,7 +52,7 @@ class RegressionLayer(M.Module):
sz = (input_size, target_size) sz = (input_size, target_size)
rng = N.random.RandomState(seed) rng = N.random.RandomState(seed)
obj.w = rng.uniform(size = sz, low = -0.5, high = 0.5) obj.w = rng.uniform(size = sz, low = -0.5, high = 0.5)
obj.b = N.zeros(target_size) obj.b = np.zeros(target_size)
obj.stepsize = 0.01 obj.stepsize = 0.01
# here we call the default_initialize method, which takes all the name: value # here we call the default_initialize method, which takes all the name: value
# pairs in init and sets the property with that name to the provided value # pairs in init and sets the property with that name to the provided value
...@@ -93,8 +93,8 @@ def test_module_advanced_example(): ...@@ -93,8 +93,8 @@ def test_module_advanced_example():
profmode = PrintEverythingMode(theano.gof.OpWiseCLinker(), 'fast_run') profmode = PrintEverythingMode(theano.gof.OpWiseCLinker(), 'fast_run')
data_x = N.random.randn(4, 10) data_x = np.random.randn(4, 10)
data_y = [ [int(x)] for x in (N.random.randn(4) > 0)] data_y = [ [int(x)] for x in (np.random.randn(4) > 0)]
model = SpecifiedRegressionLayer(regularize = False).make(input_size = 10, model = SpecifiedRegressionLayer(regularize = False).make(input_size = 10,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论