diff --git a/.github/workflows/scripts/labeler.js b/.github/workflows/scripts/labeler.js index 769683174688..a9084c187b7f 100644 --- a/.github/workflows/scripts/labeler.js +++ b/.github/workflows/scripts/labeler.js @@ -13,37 +13,59 @@ You may obtain a copy of the License at limitations under the License. */ - /** * Invoked from labeler.yaml file to add * label 'Gemma' to the issue and PR for which have gemma keyword present. * @param {!Object.} github contains pre defined functions. - * context Information about the workflow run. + * context Information about the workflow run. */ module.exports = async ({ github, context }) => { - const issue_title = context.payload.issue ? context.payload.issue.title : context.payload.pull_request.title - const issue_description = context.payload.issue ? context.payload.issue.body : context.payload.pull_request.body - const issue_number = context.payload.issue ? context.payload.issue.number : context.payload.pull_request.number + // Determine if the event is an issue or a pull request. + const isIssue = !!context.payload.issue; + + // Get the issue/PR title, description, and number from the payload. + // Use an empty string for the description if it's null to prevent runtime errors. + const issue_title = isIssue ? context.payload.issue.title : context.payload.pull_request.title; + const issue_description = (isIssue ? context.payload.issue.body : context.payload.pull_request.body) || ''; + const issue_number = isIssue ? context.payload.issue.number : context.payload.pull_request.number; + + // Define the keyword-to-label mapping. const keyword_label = { - gemma:'Gemma' - } - const labelsToAdd = [] - console.log(issue_title,issue_description,issue_number) + gemma: 'Gemma' + }; - for(const [keyword, label] of Object.entries(keyword_label)){ - if(issue_title.toLowerCase().indexOf(keyword) !=-1 || issue_description.toLowerCase().indexOf(keyword) !=-1 ){ - console.log(`'${keyword}'keyword is present inside the title or description. Pushing label '${label}' to row.`) - labelsToAdd.push(label) + // Array to hold labels that need to be added. + const labelsToAdd = []; + + console.log(`Processing event for issue/PR #${issue_number}: "${issue_title}"`); + + // Loop through the keywords and check if they exist in the title or description. + for (const [keyword, label] of Object.entries(keyword_label)) { + // Use .includes() for a cleaner and more modern check. + if (issue_title.toLowerCase().includes(keyword) || issue_description.toLowerCase().includes(keyword)) { + console.log(`'${keyword}' keyword is present in the title or description. Pushing label '${label}' to the array.`); + labelsToAdd.push(label); + } + } + + // Add labels if the labelsToAdd array is not empty. + if (labelsToAdd.length > 0) { + console.log(`Adding labels ${labelsToAdd} to issue/PR '#${issue_number}'.`); + + try { + // Await the asynchronous API call to ensure it completes. + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, // Use the correct issue_number variable + labels: labelsToAdd + }); + console.log(`Successfully added labels.`); + } catch (error) { + console.error(`Failed to add labels: ${error.message}`); + } + } else { + console.log("No matching keywords found. No labels to add."); } - } - if(labelsToAdd.length > 0){ - console.log(`Adding labels ${labelsToAdd} to the issue '#${issue_number}'.`) - github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - labels: labelsToAdd - }) - } -}; \ No newline at end of file +}; diff --git a/keras/src/backend/openvino/numpy.py b/keras/src/backend/openvino/numpy.py index 614799982b87..56751a085c09 100644 --- a/keras/src/backend/openvino/numpy.py +++ b/keras/src/backend/openvino/numpy.py @@ -34,6 +34,7 @@ def diagonal(x, offset=0, axis1=0, axis2=1): ov_opset.add(ov_opset.constant(int(axis2), dtype="i64"), rank_val), rank_val, ) + arange = ov_opset.range( ov_opset.constant(0, dtype="i64"), rank_val, @@ -778,6 +779,7 @@ def deg2rad(x): def diag(x, k=0): raise NotImplementedError("`diag` is not supported with openvino backend") + def diff(a, n=1, axis=-1): if n == 0: return OpenVINOKerasTensor(get_ov_output(a))