def aux(out_x, outs):
     head = outs[0]
     tail = outs[1:]
     if tail:
         return 'int {} = i / ({}) % {};'.format(
             out_x, conv_nd_kernel.mulexp(tail), head)
     else:
         return 'int {} = i % {};'.format(out_x, head)
 def aux(x, ds, p):
     head = ds[0]
     tail = ds[1:]
     if tail:
         return 'int {} = i / ({}) % {} + {};'.format(
             x, conv_nd_kernel.mulexp(tail), head, p)
     else:
         return 'int {} = i % {} + {};'.format(x, head, p)
Example #3
0
 def aux(out_x, outs):
     head = outs[0]
     tail = outs[1:]
     if tail:
         return 'int {} = i / ({}) % {};'.format(
             out_x, conv_nd_kernel.mulexp(tail), head)
     else:
         return 'int {} = i % {};'.format(out_x, head)
Example #4
0
 def aux(x, ds, p):
     head = ds[0]
     tail = ds[1:]
     if tail:
         return 'int {} = i / ({}) % {} + {};'.format(
             x, conv_nd_kernel.mulexp(tail), head, p)
     else:
         return 'int {} = i % {} + {};'.format(x, head, p)
 def aux(max_val, out_val, stride_val, pad_val, ksize_vals):
     head = ksize_vals[0]
     tail = ksize_vals[1:]
     if tail:
         command = 'int {} = max(0, {} * {} - {} + index / ({}) % {});'
         return command.format(max_val, out_val, stride_val, pad_val,
                               conv_nd_kernel.mulexp(tail), head)
     else:
         return 'int {} = max(0, {} * {} - {} + index % {});'.format(
             max_val, out_val, stride_val, pad_val, head)
Example #6
0
 def aux(max_val, out_val, stride_val, pad_val, ksize_vals):
     head = ksize_vals[0]
     tail = ksize_vals[1:]
     if tail:
         command = 'int {} = max(0, {} * {} - {} + index / ({}) % {});'
         return command.format(
             max_val, out_val, stride_val, pad_val,
             conv_nd_kernel.mulexp(tail), head)
     else:
         return 'int {} = max(0, {} * {} - {} + index % {});'.format(
             max_val, out_val, stride_val, pad_val, head)
 def _compile_c0(self):
     # 2D: int c0 = i / (out_0 * out_1);
     return ['int c0 = i / ({});'.format(conv_nd_kernel.mulexp(self.outs))]
Example #8
0
 def _compile_c0(self):
     # 2D: int c0 = i / (out_0 * out_1);
     return ['int c0 = i / ({});'.format(conv_nd_kernel.mulexp(self.outs))]