MCPcopy Create free account
hub / github.com/pytorch/pytorch / GetLearningRateBlobNames

Function GetLearningRateBlobNames

caffe2/python/data_parallel_model.py:987–1006  ·  view source on GitHub ↗

Returns a list of learning rates blob names used in the optimizer.

(model)

Source from the content-addressed store, hash-verified

985
986
987def GetLearningRateBlobNames(model):
988 '''
989 Returns a list of learning rates blob names used in the optimizer.
990 '''
991 if model._optimizer is not None:
992 if model._device_type == caffe2_pb2.CPU or model._device_type == caffe2_pb2.IDEEP:
993 return [model._optimizer.get_cpu_blob_name('lr')]
994 elif core.IsGPUDeviceType(model._device_type):
995 return [model._optimizer.get_gpu_blob_name('lr', gpu, '')
996 for gpu in model._devices]
997 else:
998 raise Exception(
999 "Unsupported device type : {}".format(model._device_type)
1000 )
1001 else:
1002 lr_blob_names = []
1003 for op in model.net.Proto().op:
1004 if op.type == "LearningRate":
1005 lr_blob_names.append(op.output(0))
1006 return lr_blob_names
1007
1008
1009def _Broadcast(devices, model, net, param, use_nccl=False):

Callers

nothing calls this directly

Calls 7

ExceptionClass · 0.85
get_cpu_blob_nameMethod · 0.80
get_gpu_blob_nameMethod · 0.80
formatMethod · 0.45
ProtoMethod · 0.45
appendMethod · 0.45
outputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…