MCPcopy Create free account
hub / github.com/BVLC/caffe / CheckCaffeAlternatives

Function CheckCaffeAlternatives

scripts/cpp_lint.py:1576–1596  ·  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

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

Callers 1

ProcessLineFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected