Skip to content

Commit 6a61fce

Browse files
committed
Merge branch 'main' into depth-pro
2 parents e02fccf + 7d6f459 commit 6a61fce

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tutorials/depth-anything/depth-anything-coreml-guide.ipynb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,18 +717,25 @@
717717
},
718718
{
719719
"cell_type": "code",
720-
"execution_count": 24,
720+
"execution_count": null,
721721
"id": "7edfabd9-cccf-475c-846d-d942fb1f8e26",
722722
"metadata": {},
723723
"outputs": [],
724724
"source": [
725725
"@register_torch_op\n",
726726
"def upsample_bicubic2d(context, node):\n",
727727
" a = context[node.inputs[0]]\n",
728+
" output_size = context[node.inputs[1]].val\n",
728729
" align_corners = context[node.inputs[2]].val\n",
729730
" scale = context[node.inputs[3]]\n",
730-
" scale_h = scale.val[0]\n",
731-
" scale_w = scale.val[1]\n",
731+
" if scale is None:\n",
732+
" input_height = a.shape[-2]\n",
733+
" input_width = a.shape[-1]\n",
734+
" scale_h = output_size[0] / input_height\n",
735+
" scale_w = output_size[1] / input_width\n",
736+
" else:\n",
737+
" scale_h = scale.val[0]\n",
738+
" scale_w = scale.val[1]\n",
732739
" \n",
733740
" x = mb.upsample_bilinear(x=a, scale_factor_height=scale_h, scale_factor_width=scale_w, align_corners=align_corners, name=node.name)\n",
734741
" context.add(x)"

0 commit comments

Comments
 (0)