main.es6 721 字节
Newer Older
W
wangqun 已提交
1 2 3 4 5 6 7 8 9
/* eslint-disable */
/**
 * @file 加法主函数
 * @author yangmingming
 */
export default `
// start函数
void main(void) {
    // 输出数据
W
wangqun 已提交
10 11 12
    ivec4 oPos = getOutputTensorPos();
    float o = getValueFromTensorPos_origin(oPos.r, oPos.g, oPos.b, oPos.a);
	ivec4 pos_counter;
W
wangqun 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25 26
	float c = 0.0;

	if (axis == 1){
        c = getValueFromTensorPos_counter(0, oPos.r, oPos.g, oPos.b);
    }
    else if (axis == 2){
        c = getValueFromTensorPos_counter(0, 0, oPos.r, oPos.g);
    }
    else if (axis == 3){
        c = getValueFromTensorPos_counter(0, 0, 0, oPos.r);
    }
    else {
        c = getValueFromTensorPos_counter(oPos.r, oPos.g, oPos.b, oPos.a);
    }
W
wangqun 已提交
27
	float res = c + o;
W
wangqun 已提交
28
	setOutput(float(res));
W
wangqun 已提交
29 30
}
`;