Skip to content

Commit

Permalink
Merge branch 'main' into depth-pro
Browse files Browse the repository at this point in the history
  • Loading branch information
greenrazer committed Dec 2, 2024
2 parents e02fccf + 7d6f459 commit 6a61fce
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tutorials/depth-anything/depth-anything-coreml-guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -717,18 +717,25 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"id": "7edfabd9-cccf-475c-846d-d942fb1f8e26",
"metadata": {},
"outputs": [],
"source": [
"@register_torch_op\n",
"def upsample_bicubic2d(context, node):\n",
" a = context[node.inputs[0]]\n",
" output_size = context[node.inputs[1]].val\n",
" align_corners = context[node.inputs[2]].val\n",
" scale = context[node.inputs[3]]\n",
" scale_h = scale.val[0]\n",
" scale_w = scale.val[1]\n",
" if scale is None:\n",
" input_height = a.shape[-2]\n",
" input_width = a.shape[-1]\n",
" scale_h = output_size[0] / input_height\n",
" scale_w = output_size[1] / input_width\n",
" else:\n",
" scale_h = scale.val[0]\n",
" scale_w = scale.val[1]\n",
" \n",
" x = mb.upsample_bilinear(x=a, scale_factor_height=scale_h, scale_factor_width=scale_w, align_corners=align_corners, name=node.name)\n",
" context.add(x)"
Expand Down

0 comments on commit 6a61fce

Please sign in to comment.