提交 07b866b5 authored 作者: Frederic's avatar Frederic

Move fct in the only file it is used. the reorganization didn't move it to the right place.

上级 87c4b66d
...@@ -19,7 +19,7 @@ from theano import scalar as scal ...@@ -19,7 +19,7 @@ from theano import scalar as scal
from theano.tensor.basic import (addbroadcast, clip, sum, exp, from theano.tensor.basic import (addbroadcast, clip, sum, exp,
ARange, TensorType) ARange, TensorType)
from theano.tensor.elemwise import DimShuffle from theano.tensor.elemwise import DimShuffle
from theano.tensor.type_other import NoneConst, SliceType from theano.tensor.type_other import NoneConst, SliceType, make_slice
from theano import config from theano import config
inplace_increment = None inplace_increment = None
...@@ -1770,15 +1770,6 @@ def as_index_variable(idx): ...@@ -1770,15 +1770,6 @@ def as_index_variable(idx):
return idx return idx
def as_int_none_variable(x):
if x is None:
return NoneConst
x = theano.tensor.as_tensor_variable(x, ndim=0)
if x.type.dtype[:3] not in ('int', 'uin'):
raise TypeError('index must be integers')
return x
def adv_index_broadcastable_pattern(a, idx): def adv_index_broadcastable_pattern(a, idx):
""" """
This function is only used to determine the broadcast pattern for This function is only used to determine the broadcast pattern for
......
...@@ -5,6 +5,15 @@ from theano.gof import Apply, Constant, Op, Type ...@@ -5,6 +5,15 @@ from theano.gof import Apply, Constant, Op, Type
from theano.gradient import DisconnectedType from theano.gradient import DisconnectedType
def as_int_none_variable(x):
if x is None:
return NoneConst
x = theano.tensor.as_tensor_variable(x, ndim=0)
if x.type.dtype[:3] not in ('int', 'uin'):
raise TypeError('index must be integers')
return x
class MakeSlice(Op): class MakeSlice(Op):
def make_node(self, slc): def make_node(self, slc):
return Apply(self, return Apply(self,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论