ngraph.utils.input_validation.check_valid_attribute

ngraph.utils.input_validation.check_valid_attribute(op_name: str, attr_dict: dict, attr_key: str, val_type: Type, cond: Optional[Callable[[Any], bool]] = None, required: Optional[bool] = False) bool

Check whether specified attribute satisfies given criteria.

Parameters
  • op_name – The operator name which attributes are checked.

  • attr_dict – Dictionary containing key-value attributes to check.

  • attr_key – Key value for validated attribute.

  • val_type – Value type for validated attribute.

  • cond – Any callable wich accept attribute value and returns True or False.

  • required – Whether provided attribute key is not required. This mean it may be missing from provided dictionary.

Raises

UserInputError

Returns

True if attribute satisfies all criterias. Otherwise False.