export tutorials changed in dd88513 (#559)
Co-authored-by: dario-coscia <dario-coscia@users.noreply.github.com>
This commit is contained in:
committed by
Dario Coscia
parent
228f807d92
commit
d10c525e74
18
tutorials/tutorial19/tutorial.ipynb
vendored
18
tutorials/tutorial19/tutorial.ipynb
vendored
@@ -26,12 +26,13 @@
|
||||
"source": [
|
||||
"## routine needed to run the notebook on Google Colab\n",
|
||||
"try:\n",
|
||||
" import google.colab\n",
|
||||
" IN_COLAB = True\n",
|
||||
" import google.colab\n",
|
||||
"\n",
|
||||
" IN_COLAB = True\n",
|
||||
"except:\n",
|
||||
" IN_COLAB = False\n",
|
||||
" IN_COLAB = False\n",
|
||||
"if IN_COLAB:\n",
|
||||
" !pip install \"pina-mathlab[tutorial]\"\n",
|
||||
" !pip install \"pina-mathlab[tutorial]\"\n",
|
||||
"\n",
|
||||
"import warnings\n",
|
||||
"import torch\n",
|
||||
@@ -229,7 +230,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(f'{tensor.labels=}')\n",
|
||||
"print(f\"{tensor.labels=}\")\n",
|
||||
"print(f\"{tensor.full_labels=}\")"
|
||||
]
|
||||
},
|
||||
@@ -329,7 +330,7 @@
|
||||
")\n",
|
||||
"\n",
|
||||
"print(f'Extract labels: {label_tensor.extract({\"points\" : [0, 2]})=}')\n",
|
||||
"print(f'Similar to: {label_tensor[slice(0, 4, 2), :]=}')"
|
||||
"print(f\"Similar to: {label_tensor[slice(0, 4, 2), :]=}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -504,8 +505,9 @@
|
||||
],
|
||||
"source": [
|
||||
"# Node features: [2 nodes, 3 features]\n",
|
||||
"x = LabelTensor(torch.tensor([[1, 2, 3], [4, 5, 6]], dtype=torch.float),\n",
|
||||
" [\"a\", \"b\", \"c\"])\n",
|
||||
"x = LabelTensor(\n",
|
||||
" torch.tensor([[1, 2, 3], [4, 5, 6]], dtype=torch.float), [\"a\", \"b\", \"c\"]\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# Edge indices: representing a graph with two edges (node 0 to node 1, node 1 to node 0)\n",
|
||||
"edge_index = torch.tensor([[0, 1], [1, 0]], dtype=torch.long)\n",
|
||||
|
||||
Reference in New Issue
Block a user