MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / __init__

Method __init__

python/paddle/jit/dy2static/program_translator.py:287–322  ·  view source on GitHub ↗

Initializes a cache key. Args: functions_spec(FunctionSpec): a FunctionSpec instance of decorated function. input_args_with_spec(list[InputSpec]): actual input args with some arguments replaced by InputSpec. input_kwargs_with_spec(list[{string:In

(
        self,
        function_spec,
        input_args_with_spec,
        input_kwargs_with_spec,
        class_instance,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

285 ]
286
287 def __init__(
288 self,
289 function_spec,
290 input_args_with_spec,
291 input_kwargs_with_spec,
292 class_instance,
293 **kwargs,
294 ):
295 """
296 Initializes a cache key.
297
298 Args:
299 functions_spec(FunctionSpec): a FunctionSpec instance of decorated function.
300 input_args_with_spec(list[InputSpec]): actual input args with some arguments replaced by InputSpec.
301 input_kwargs_with_spec(list[{string:InputSpec}]): actual input kwargs with some arguments replaced by InputSpec.
302 class_instance(object): a instance of class `Layer`.
303 **kwargs(dict): manage other arguments used for better scalability
304 """
305 self.function_spec = function_spec
306 self.input_args_with_spec = input_args_with_spec
307 self.input_kwargs_with_spec = input_kwargs_with_spec
308 self.class_instance = class_instance
309 self.is_grad_enabled = paddle.is_grad_enabled()
310 # NOTE: `kwargs` is usually not considered as basic member for `__hash__`
311 self.kwargs = kwargs
312 self._spec_names_id = _hash_spec_names(
313 input_args_with_spec, input_kwargs_with_spec
314 )
315 self._pir_flags = (
316 get_flags('FLAGS_enable_pir_in_executor')[
317 'FLAGS_enable_pir_in_executor'
318 ]
319 or get_flags('FLAGS_enable_pir_with_pt_in_dy2st')[
320 'FLAGS_enable_pir_with_pt_in_dy2st'
321 ]
322 )
323
324 @classmethod
325 def from_func_and_args(cls, function_spec, args, kwargs, class_instance):

Callers 3

__init__Method · 0.45
__init__Method · 0.45
resetMethod · 0.45

Calls 2

get_flagsFunction · 0.90
_hash_spec_namesFunction · 0.85

Tested by

no test coverage detected