Python theano.tensor 模块,itensor4() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用theano.tensor.itensor4()

项目:pixel-rnn-lasagne    作者:taimir    | 项目源码 | 文件源码
def __init__(self, batch_size, image_shape, n_hidden):
        """
        :param batch_size: how many images to have in a single minibatch
        :param image_shape: (channels x height x width)
        :param n_hidden: number of hidden units in the MD-RNN
        """
        self.batch_size = batch_size
        self.input_channels = image_shape[0]
        self.h = n_hidden
        self.height = image_shape[1]
        self.width = image_shape[2]
        self.out_channels = n_hidden
        self.n_colors = image_shape[0]
        self.inputs = T.tensor4("images")
        self.labels = T.itensor4("labels")
        self.network, self.loss, self.output = self._define_network(self.inputs, self.labels)
        self._define_forward_passes(self.network, self.loss, self.output, self.inputs, self.labels)
项目:CopyNet    作者:MultiPath    | 项目源码 | 文件源码
def ndim_itensor(ndim, name=None):
    if ndim == 2:
        return T.imatrix(name)
    elif ndim == 3:
        return T.itensor3(name)
    elif ndim == 4:
        return T.itensor4(name)
    return T.imatrix(name)


# dot-product
项目:seq2seq-keyphrase    作者:memray    | 项目源码 | 文件源码
def ndim_itensor(ndim, name=None):
    if ndim == 2:
        return T.imatrix(name)
    elif ndim == 3:
        return T.itensor3(name)
    elif ndim == 4:
        return T.itensor4(name)
    return T.imatrix(name)


# dot-product
项目:CopyNet    作者:MingyuanXie    | 项目源码 | 文件源码
def ndim_itensor(ndim, name=None):
    if ndim == 2:
        return T.imatrix(name)
    elif ndim == 3:
        return T.itensor3(name)
    elif ndim == 4:
        return T.itensor4(name)
    return T.imatrix(name)


# dot-product
项目:WebNav    作者:nyu-dl    | 项目源码 | 文件源码
def make_node(self, x, x2, x3, x4, x5):
        # check that the theano version has support for __props__.
        # This next line looks like it has a typo,
        # but it's actually a way to detect the theano version
        # is sufficiently recent to support the use of __props__.
        assert hasattr(self, '_props'), "Your version of theano is too old to support __props__."
        x = tensor.as_tensor_variable(x)
        x2 = tensor.as_tensor_variable(x2)
        x3 = tensor.as_tensor_variable(x3)
        x4 = tensor.as_tensor_variable(x4)
        x5 = tensor.as_tensor_variable(x5)

        if prm.att_doc:
            if prm.compute_emb:
                td = tensor.itensor4().type()
            else:
                td = tensor.ftensor4().type()
            tm = tensor.ftensor3().type()
        else:
            if prm.compute_emb:
                td = tensor.itensor3().type()
            else:
                td = tensor.ftensor3().type()
            tm = tensor.fmatrix().type()
        return theano.Apply(self, [x,x2,x3,x4,x5], [td, tm, \
                                           tensor.fmatrix().type(), tensor.ivector().type()])