def _num_samples(x):
if hasattr(x, '<STR_LIT>'):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>' % x)<EOL><DEDENT>if not hasattr(x, '<STR_LIT>') and not hasattr(x, '<STR_LIT>'):<EOL><INDENT>if hasattr(x, '<STR_LIT>'):<EOL><INDENT>x = np.asarray(x)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" %<EOL>type(x))<EOL><DEDENT><DEDENT>if hasattr(x, '<STR_LIT>'):<EOL><INDENT>if len(x.shape) == <NUM_LIT:0>:<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>" % x)<EOL><DEDENT>return x.shape[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>return len(x)<EOL><DEDENT>
Return number of samples in array-like x.