246 else:
247 if not self.context.is_initialized and not self._context_initialized:
248 self.context.init_state()
249 self._context_initialized = True250
251 self.context.full_parallel(self.params, data, num_proc)
252 return [
244 self.context.is_initialized
245 ), "strict=True and context is not initialized. Make sure to call 'context.init_state()' before."
246 else:
247 if not self.context.is_initialized and not self._context_initialized:248 self.context.init_state()
249 self._context_initialized = True
250
580 elif args.arch.startswith("efficientnet"):
581 set_parameter_requires_grad(model_ft, feature_extract)
582 num_ftrs = model_ft._fc.in_features # pylint: disable=protected-access
583 model_ft._fc = nn.Linear(584 num_ftrs, num_classes
585 ) # pylint: disable=protected-access
586
171 )
172
173 else:
174 model_ft._fc = nn.Linear(175 num_ftrs, num_classes
176 ) # pylint: disable=protected-access
177
161
162 if self.hparams.feature_extract == "advanced":
163 model_ft._avg_pooling = AdaptiveConcatPool2d(1) # noqa: F405
164 model_ft._fc = nn.Sequential(165 nn.Flatten(),
166 nn.Linear(num_ftrs * 2, 512),
167 MemoryEfficientSwish(),
Accessing a protected member (a member prefixed with _
) of a class from outside that class is not recommended, since the creator of that class did not intend this member to be exposed. If accesing this attribute outside of the class is absolutely needed, refactor it such that it becomes part of the public interface of the class.
class Rectangle(object):
def __init__(self, height, width):
self._height = height
self._width = width
r = Rectangle(4, 8)
area = r._height * r._width
class Rectangle(object):
def __init__(self, height, width):
self._height = height
self._width = width
def area():
return self._height * self._width
r = Rectangle(4, 8)
area = r.area()