MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / CheckCaffeAlternatives

Function CheckCaffeAlternatives

rtpose_wrapper/scripts/cpp_lint.py:1572–1592  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1570
1571
1572def 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
1595def CheckCaffeDataLayerSetUp(filename, clean_lines, linenum, error):

Callers 1

ProcessLineFunction · 0.85

Calls 2

errorFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected