铜陵网站建设推广,上海专业seo公司,静态商城网页模板,成都p2p网站建设问题#xff1a;给一个tensor A中[i,j]#xff0c;赋值p。直接操作A[i,j]p可能会导致值覆盖#xff0c;操作不可导。
解决方案#xff1a;通过引入一个额外的mask实现。
mask[i,j] 0
mask tf.convert_to_tensor(mask, dtypetf.float32)
A (A * mask) (p * (1-mask))p…问题给一个tensor A中[i,j]赋值p。直接操作A[i,j]p可能会导致值覆盖操作不可导。
解决方案通过引入一个额外的mask实现。
mask[i,j] 0
mask tf.convert_to_tensor(mask, dtypetf.float32)
A (A * mask) (p * (1-mask))ps: 没debug, 看起来是对的。
参考https://github.com/hadjisma/VideoAlignment/blob/master/d2tw/smoothDTW.py#L44