(stroke, max_len=250)
return result
Converts from stroke-3 to stroke-5 format and pads to given length.
Converts from stroke-3 to stroke-5 format and pads to given length.
Converts from stroke - 3 to stroke - 5 format and pads to given length .
def to_big_strokes(stroke, max_len=250):
  """Converts from stroke-3 to stroke-5 format and pads to given length."""
  # (But does not insert special start token).

  result = np.zeros((max_len, 5), dtype=float)
  l = len(stroke)
  assert l <= max_len
  result[0:l, 0:2] = stroke[:, 0:2]
  result[0:l, 3] = stroke[:, 2]
  result[0:l, 2] = 1 - result[0:l, 3]
  result[l:, 4] = 1
  return result
def to_big_strokes ( stroke , max_len = 250 ) : # (But does not insert special start token). result = np . zeros ( ( max_len , 5 ) , dtype = float ) l = len ( stroke ) assert l <= max_len result [ 0 : l , 0 : 2 ] = stroke [ : , 0 : 2 ] result [ 0 : l , 3 ] = stroke [ : , 2 ] result [ 0 : l , 2 ] = 1 - result [ 0 : l , 3 ] result [ l : , 4 ] = 1 return result