提交 f39f3d69 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Fix the ability to specify a number of dimension as first argument of a random

distribution.
上级 3f596d97
...@@ -210,11 +210,12 @@ def random_function(fn, dtype, *rfargs, **rfkwargs): ...@@ -210,11 +210,12 @@ def random_function(fn, dtype, *rfargs, **rfkwargs):
- constants - constants
""" """
@constructor @constructor
def f(ndim, *args, **kwargs): def f(r, ndim, *args, **kwargs):
print 'f(', ndim, args, ')'
if isinstance(ndim, int): if isinstance(ndim, int):
r, shape, args = args[0], args[1], args[2:] shape, args = args[0], args[1:]
else: else:
r, shape, args = ndim, args[0], args[1:] shape = ndim
if shape == () or shape == []: if shape == () or shape == []:
shape = tensor.TensorConstant(type = tensor.lvector, data = shape) shape = tensor.TensorConstant(type = tensor.lvector, data = shape)
else: else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论