MCPcopy Index your code
hub / github.com/pytorch/pytorch / commonprefix

Function commonprefix

caffe2/python/net_printer.py:226–235  ·  view source on GitHub ↗

Given a list of strings, returns the longest common prefix

(m)

Source from the content-addressed store, hash-verified

224
225
226def commonprefix(m):
227 "Given a list of strings, returns the longest common prefix"
228 if not m:
229 return ''
230 s1 = min(m)
231 s2 = max(m)
232 for i, c in enumerate(s1):
233 if c != s2[i]:
234 return s1[:i]
235 return s1
236
237
238def format_value(val):

Callers 1

factor_prefixFunction · 0.85

Calls 2

minFunction · 0.50
maxFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…