diff --git a/tutorials/depth-anything/depth-anything-coreml-guide.ipynb b/tutorials/depth-anything/depth-anything-coreml-guide.ipynb index 6c84030..263f09a 100644 --- a/tutorials/depth-anything/depth-anything-coreml-guide.ipynb +++ b/tutorials/depth-anything/depth-anything-coreml-guide.ipynb @@ -717,7 +717,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "7edfabd9-cccf-475c-846d-d942fb1f8e26", "metadata": {}, "outputs": [], @@ -725,10 +725,17 @@ "@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)"