Checks for C(++) functions for which a Caffe substitute should be used. For certain native C functions (memset, memcpy), there is a Caffe alternative which should be used instead. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file.
(filename, clean_lines, linenum, error)
| 1570 | |
| 1571 | |
| 1572 | def CheckCaffeAlternatives(filename, clean_lines, linenum, error): |
| 1573 | """Checks for C(++) functions for which a Caffe substitute should be used. |
| 1574 | |
| 1575 | For certain native C functions (memset, memcpy), there is a Caffe alternative |
| 1576 | which should be used instead. |
| 1577 | |
| 1578 | Args: |
| 1579 | filename: The name of the current file. |
| 1580 | clean_lines: A CleansedLines instance containing the file. |
| 1581 | linenum: The number of the line to check. |
| 1582 | error: The function to call with any errors found. |
| 1583 | """ |
| 1584 | line = clean_lines.elided[linenum] |
| 1585 | for function, alts in caffe_alt_function_list: |
| 1586 | ix = line.find(function + '(') |
| 1587 | if ix >= 0 and (ix == 0 or (not line[ix - 1].isalnum() and |
| 1588 | line[ix - 1] not in ('_', '.', '>'))): |
| 1589 | disp_alts = ['%s(...)' % alt for alt in alts] |
| 1590 | error(filename, linenum, 'caffe/alt_fn', 2, |
| 1591 | 'Use Caffe function %s instead of %s(...).' % |
| 1592 | (' or '.join(disp_alts), function)) |
| 1593 | |
| 1594 | |
| 1595 | def CheckCaffeDataLayerSetUp(filename, clean_lines, linenum, error): |
no test coverage detected