当前位置: 首页>>代码示例>>Python>>正文


Python base.application方法代码示例

本文整理汇总了Python中blocks.bricks.base.application方法的典型用法代码示例。如果您正苦于以下问题:Python base.application方法的具体用法?Python base.application怎么用?Python base.application使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在blocks.bricks.base的用法示例。


在下文中一共展示了base.application方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _allocate

# 需要导入模块: from blocks.bricks import base [as 别名]
# 或者: from blocks.bricks.base import application [as 别名]
def _allocate(self):
        self.W_state = shared_floatx_nans((self.dim, 4*self.dim),
                                          name='W_state')
        self.W_cell_to_in = shared_floatx_nans((self.dim,),
                                               name='W_cell_to_in')
        self.W_cell_to_forget = shared_floatx_nans((self.dim,),
                                                   name='W_cell_to_forget')
        self.W_cell_to_out = shared_floatx_nans((self.dim,),
                                                name='W_cell_to_out')
        # The underscore is required to prevent collision with
        # the `initial_state` application method
        self.initial_state_ = shared_floatx_zeros((self.dim,),
                                                  name="initial_state")
        self.initial_cells = shared_floatx_zeros((self.dim,),
                                                 name="initial_cells")
        add_role(self.W_state, WEIGHT)
        add_role(self.W_cell_to_in, WEIGHT)
        add_role(self.W_cell_to_forget, WEIGHT)
        add_role(self.W_cell_to_out, WEIGHT)
        add_role(self.initial_state_, INITIAL_STATE)
        add_role(self.initial_cells, INITIAL_STATE)

        self.parameters = [
            self.W_state, self.W_cell_to_in, self.W_cell_to_forget,
            self.W_cell_to_out, self.initial_state_, self.initial_cells] 
开发者ID:tombosc,项目名称:dict_based_learning,代码行数:27,代码来源:stuff.py

示例2: _allocate

# 需要导入模块: from blocks.bricks import base [as 别名]
# 或者: from blocks.bricks.base import application [as 别名]
def _allocate(self):
        self.W_state = shared_floatx_nans((self.dim, 4.5 * self.dim),
                                          name='W_state')
        # The underscore is required to prevent collision with
        # the `initial_state` application method
        self.initial_state_ = shared_floatx_zeros((self.dim,),
                                                  name="initial_state")
        self.initial_cells = shared_floatx_zeros((self.num_copies, self.dim),
                                                 name="initial_cells")
        add_role(self.W_state, WEIGHT)
        # add_role(self.initial_state_, INITIAL_STATE)
        # add_role(self.initial_cells, INITIAL_STATE)

        self.parameters = [self.W_state] 
开发者ID:mohammadpz,项目名称:Associative_LSTM,代码行数:16,代码来源:bricks.py

示例3: probs

# 需要导入模块: from blocks.bricks import base [as 别名]
# 或者: from blocks.bricks.base import application [as 别名]
def probs(self, readouts):
        return self.softmax.apply(readouts, extra_ndim=readouts.ndim - 2)


    # Note: the @application decorator inspects the arguments, and transparently adds args  ('application_call') 
开发者ID:chrishokamp,项目名称:neural_mt,代码行数:7,代码来源:__init__.py

示例4: initial_states

# 需要导入模块: from blocks.bricks import base [as 别名]
# 或者: from blocks.bricks.base import application [as 别名]
def initial_states(self, batch_size, *args, **kwargs):
        # TODO: support dict of outputs for application methods
        # to simplify this code.
        igru_initial_states = self.readout.initial_igru_outputs(batch_size)
        if self.igru_depth == 1:
            igru_initial_states_dict = {self.igru_states_name[0]: igru_initial_states}
        else:
            igru_initial_states_dict = {self.igru_states_name[i]: igru_initial_states[i]
                                        for i in range(self.igru_depth)}

        initial_outputs = self.readout.initial_outputs(batch_size)
        feedback = self.readout.single_feedback(initial_outputs, batch_size)
        if self.trg_dgru_depth == 1:
            feedback_dict = {self.feedback_name[0]: feedback, 'readout_feedback': feedback}
        else:
            feedback_dict = {'readout_feedback': feedback[-1]}
            feedback_dict.update({self.feedback_name[i]: feedback[i] for i in range(self.trg_dgru_depth)})

        state_dict = dict(
            self.transition.initial_states(
                batch_size, as_dict=True, *args, **kwargs),
            outputs=initial_outputs)
        state_dict.update(feedback_dict)
        state_dict.update(igru_initial_states_dict)
        return [state_dict[state_name]
                for state_name in self.generate.states] 
开发者ID:SwordYork,项目名称:DCNMT,代码行数:28,代码来源:model.py


注:本文中的blocks.bricks.base.application方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。