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


Python utils.shared_floatx_nans方法代码示例

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


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

示例1: _allocate

# 需要导入模块: from blocks import utils [as 别名]
# 或者: from blocks.utils import shared_floatx_nans [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 import utils [as 别名]
# 或者: from blocks.utils import shared_floatx_nans [as 别名]
def _allocate(self):
        """In addition to the GRU parameters ``state_to_state`` and 
        ``state_to_gates``, add the initial state if the search
        strategy is "constant".
        """
        self.parameters.append(shared_floatx_nans((self.dim, self.dim),
                               name='state_to_state'))
        self.parameters.append(shared_floatx_nans((self.dim, 2 * self.dim),
                               name='state_to_gates'))
        for i in range(2):
            if self.parameters[i]:
                add_role(self.parameters[i], WEIGHT)
        if self.init_strategy == 'constant':
            self.parameters.append(shared_floatx_zeros((self.dim,),
                                                       name="initial_state"))
            add_role(self.parameters[2], INITIAL_STATE) 
开发者ID:ucam-smt,项目名称:sgnmt,代码行数:18,代码来源:decoder.py

示例3: _allocate

# 需要导入模块: from blocks import utils [as 别名]
# 或者: from blocks.utils import shared_floatx_nans [as 别名]
def _allocate(self):
        self.parameters.append(shared_floatx_nans((self.dim, self.dim),
                               name='state_to_state'))
        self.parameters.append(shared_floatx_nans((self.dim, 2 * self.dim),
                               name='state_to_gates'))
        for i in range(2):
            if self.parameters[i]:
                add_role(self.parameters[i], WEIGHT) 
开发者ID:aeloyq,项目名称:MTBasedOnBlocks,代码行数:10,代码来源:model.py

示例4: _allocate

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

        self.parameters = [
            self.W_ss, self.W_is, self.initial_state_] 
开发者ID:aalitaiga,项目名称:Generative-models,代码行数:15,代码来源:pixelRNN.py

示例5: _allocate

# 需要导入模块: from blocks import utils [as 别名]
# 或者: from blocks.utils import shared_floatx_nans [as 别名]
def _allocate(self):
        self.params.append(shared_floatx_nans((self.dim, self.dim),
                           name='state_to_state'))
        self.params.append(shared_floatx_nans((self.dim, 2 * self.dim),
                           name='state_to_gates'))
        self.params.append(shared_floatx_zeros((self.dim,),
                           name="initial_state"))
        for i in range(2):
            if self.params[i]:
                add_role(self.params[i], WEIGHT)
        add_role(self.params[2], INITIAL_STATE) 
开发者ID:jiangnanhugo,项目名称:lmkit,代码行数:13,代码来源:bricks.py

示例6: _allocate

# 需要导入模块: from blocks import utils [as 别名]
# 或者: from blocks.utils import shared_floatx_nans [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

示例7: _allocate

# 需要导入模块: from blocks import utils [as 别名]
# 或者: from blocks.utils import shared_floatx_nans [as 别名]
def _allocate(self):
        self.parameters.append(shared_floatx_nans((self.dim, self.dim),
                               name='state_to_state'))
        self.parameters.append(shared_floatx_nans((self.dim, 2 * self.dim),
                               name='state_to_gates'))
        for i in range(2):
            if self.parameters[i]:
                add_role(self.parameters[i], WEIGHT)


# WORKING HERE -- initialize decoder initial state with constraint representation vector 
开发者ID:chrishokamp,项目名称:neural_mt,代码行数:13,代码来源:model.py

示例8: _allocate

# 需要导入模块: from blocks import utils [as 别名]
# 或者: from blocks.utils import shared_floatx_nans [as 别名]
def _allocate(self):
        """Allocates the alignment matrix parameter """
        align_matrix = shared_floatx_nans((self.matrix_size, self.matrix_size),
                                          name='alignment_matrix')
        add_role(align_matrix, WEIGHT)
        self.parameters.append(align_matrix) 
开发者ID:ucam-smt,项目名称:sgnmt,代码行数:8,代码来源:attention.py

示例9: _allocate

# 需要导入模块: from blocks import utils [as 别名]
# 或者: from blocks.utils import shared_floatx_nans [as 别名]
def _allocate(self):
        self.parameters.append(shared_floatx_nans((self.dim, self.dim),
                                                  name='state_to_state'))
        self.parameters.append(shared_floatx_nans((self.dim, 2 * self.dim),
                                                  name='state_to_gates'))
        for i in range(2):
            if self.parameters[i]:
                add_role(self.parameters[i], WEIGHT) 
开发者ID:SwordYork,项目名称:DCNMT,代码行数:10,代码来源:model.py


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