提交 72f174f9 authored 作者: Sina Honari's avatar Sina Honari

improving the comments

上级 540f0241
...@@ -223,22 +223,23 @@ class Scan(PureOp): ...@@ -223,22 +223,23 @@ class Scan(PureOp):
'in the inner function of scan %s ' 'in the inner function of scan %s '
'however has dtype %s and %d dimension(s). This ' 'however has dtype %s and %d dimension(s). This '
'slice in the inner function of scan should ' 'slice in the inner function of scan should '
'have the same dtype and one fewer dimension in its ' 'have the same dtype and one fewer dimension '
'leading dimension compared to its corresponding ' 'compared to its corresponding slice in the initial '
'slice in the initial state (outputs_info in scan ' 'state (outputs_info in scan nomenclature). For example, '
'nomenclature). For example, if the inner function ' 'if the inner function of scan returns a vector '
'of scan returns a vector of dimensionality d and ' '(dimensionality 1) of size d and scan uses the values of '
'scan uses the values of the previous time-step, then ' 'the previous time-step, then the initial state in scan '
'the initial state in scan should be a matrix of ' 'should be a matrix (dimensionality 2) of shape (1, d). '
'dimensionality (1, d). The first dimension of this ' 'The first dimension of this '
'matrix corresponds to the number of previous time-steps' 'matrix corresponds to the number of previous time-steps'
'that scan uses in each of its iterations. If for ' 'that scan uses in each of its iterations. If for '
'example scan uses up to 3 previous time-step values, ' 'example scan uses up to 3 previous time-step values, '
'the initial matrix should have dimensionality of (3, d). ' 'the initial matrix should have a shape of (3, d). '
'In order to solve this issue if the two slices currently ' 'In order to solve this issue if the two slices currently '
'have the same dimensionality, you can increase the first ' 'have the same dimensionality, you can increase the '
'dimension of the initial state in scan by using ' 'dimensionality of the slice in the initial state of scan '
'dimshuffle or shape_padleft. As an exmaple, if you only ' 'by using dimshuffle or shape_padleft. '
'As an exmaple, if you only '
'use the values of the previous time-step and the ' 'use the values of the previous time-step and the '
'corresponding variable in the inner function of scan ' 'corresponding variable in the inner function of scan '
'returns a vector, then use v.dimshuffle(\'x\', 0) or ' 'returns a vector, then use v.dimshuffle(\'x\', 0) or '
...@@ -260,20 +261,21 @@ class Scan(PureOp): ...@@ -260,20 +261,21 @@ class Scan(PureOp):
'of variable %s (argument number %d) has %d dimension(s), ' 'of variable %s (argument number %d) has %d dimension(s), '
'while the corresponding slice in the result of the inner ' 'while the corresponding slice in the result of the inner '
'function of scan (`fn`) has %d dimension(s) (it should ' 'function of scan (`fn`) has %d dimension(s) (it should '
'be one less than the initial state). ' 'be one less than the initial state). For example, '
'For example, if the inner function ' 'if the inner function of scan returns a vector '
'of scan returns a vector of dimensionality d and ' '(dimensionality 1) of size d and scan uses the values of '
'scan uses the values of the previous time-step, then ' 'the previous time-step, then the initial state in scan '
'the initial state in scan should be a matrix of ' 'should be a matrix (dimensionality 2) of shape (1, d). '
'dimensionality (1, d). The first dimension of this ' 'The first dimension of this '
'matrix corresponds to the number of previous time-steps' 'matrix corresponds to the number of previous time-steps'
'that scan uses in each of its iterations. If for ' 'that scan uses in each of its iterations. If for '
'example scan uses up to 3 previous time-step values, ' 'example scan uses up to 3 previous time-step values, '
'the initial matrix should have dimensionality of (3, d). ' 'the initial matrix should have a shape of (3, d). '
'In order to solve this issue if the two slices currently ' 'In order to solve this issue if the two slices currently '
'have the same dimensionality, you can increase the first ' 'have the same dimensionality, you can increase the '
'dimension of the initial state in scan by using ' 'dimensionality of the slice in the initial state of scan '
'dimshuffle or shape_padleft. As an exmaple, if you only ' 'by using dimshuffle or shape_padleft. '
'As an exmaple, if you only '
'use the values of the previous time-step and the ' 'use the values of the previous time-step and the '
'corresponding variable in the inner function of scan ' 'corresponding variable in the inner function of scan '
'returns a vector, then use v.dimshuffle(\'x\', 0) or ' 'returns a vector, then use v.dimshuffle(\'x\', 0) or '
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论