提交 121d9a4e authored 作者: AndreiCostinescu's avatar AndreiCostinescu

Changed comments to docstrings where necessary in theano/gpuarray/tests

上级 557ded05
...@@ -26,7 +26,7 @@ class Model(object): ...@@ -26,7 +26,7 @@ class Model(object):
def uniform(stdev, size): def uniform(stdev, size):
# uniform distribution with the given stdev and size """uniform distribution with the given stdev and size"""
return np.random.uniform( return np.random.uniform(
low=-stdev * np.sqrt(3), low=-stdev * np.sqrt(3),
high=stdev * np.sqrt(3), high=stdev * np.sqrt(3),
...@@ -36,7 +36,7 @@ def uniform(stdev, size): ...@@ -36,7 +36,7 @@ def uniform(stdev, size):
def linear_transform_weights(input_dim, output_dim, def linear_transform_weights(input_dim, output_dim,
param_list=None, name=""): param_list=None, name=""):
# theano shared variable given input and output dimension "theano shared variable given input and output dimension"
weight_inialization = uniform(np.sqrt(2.0 / input_dim), weight_inialization = uniform(np.sqrt(2.0 / input_dim),
(input_dim, output_dim)) (input_dim, output_dim))
W = theano.shared(weight_inialization, name=name) W = theano.shared(weight_inialization, name=name)
......
...@@ -15,8 +15,10 @@ from ..type import GpuArrayType, get_context, gpu_context_type ...@@ -15,8 +15,10 @@ from ..type import GpuArrayType, get_context, gpu_context_type
# This is an implementation to test that CGpuKernelBase works and also # This is an implementation to test that CGpuKernelBase works and also
# to use as an example in the docs. It is not used for user graphs. # to use as an example in the docs. It is not used for user graphs.
class GpuEye(CGpuKernelBase, Op): class GpuEye(CGpuKernelBase, Op):
# Eye for GPU. """
Eye for GPU.
"""
__props__ = ('dtype', 'context_name') __props__ = ('dtype', 'context_name')
params_type = ParamsType(typecode=int_t, context=gpu_context_type) params_type = ParamsType(typecode=int_t, context=gpu_context_type)
......
...@@ -77,8 +77,9 @@ class TestCTC(unittest.TestCase): ...@@ -77,8 +77,9 @@ class TestCTC(unittest.TestCase):
utt.assert_allclose(cpu_cost, cost_from_gpu) utt.assert_allclose(cpu_cost, cost_from_gpu)
def check_grads_disabled(self, activations, labels, input_length): def check_grads_disabled(self, activations, labels, input_length):
# Check if optimization to disable gradients is working """
Check if optimization to disable gradients is working
"""
gpu_ctc_cost = gpu_ctc(activations, labels, input_length) gpu_ctc_cost = gpu_ctc(activations, labels, input_length)
gpu_ctc_function = theano.function([], [gpu_ctc_cost]) gpu_ctc_function = theano.function([], [gpu_ctc_cost])
for node in gpu_ctc_function.maker.fgraph.apply_nodes: for node in gpu_ctc_function.maker.fgraph.apply_nodes:
......
# Some pickle test when pygpu isn't there. The test when pygpu is """
# available are in test_type.py. Some pickle test when pygpu isn't there. The test when pygpu is
# available are in test_type.py.
# This is needed as we skip all the test file when pygpu isn't there in
# regular test file.
This is needed as we skip all the test file when pygpu isn't there in
regular test file.
"""
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
import os import os
import sys import sys
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论