ipynb • Lines: 216{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "4a3c9798-6ce2-4425-98d2-e07a55f8852e",
"metadata": {},
"outputs": [],
"source": [
"import torch\n",
"import tensorflow as tf"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bf75431b-23c3-44c4-a375-21dcab62b414",
"metadata": {},
"outputs": [],
"source": [
"a = torch.tensor([1,2])\n",
"a.size()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5408f0a7-90a9-493f-84d2-06086f14b42f",
"metadata": {},
"outputs": [],
"source": [
"a\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d919cc22-6931-4097-9062-7b5259754bea",
"metadata": {},
"outputs": [],
"source": [
"b = torch.tensor([3,4])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3114104a-a63a-4ca7-be61-6b21978cd75d",
"metadata": {},
"outputs": [],
"source": [
"a+b"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3ad8ced9-821d-4b61-bf01-3fb61c63acd2",
"metadata": {},
"outputs": [],
"source": [
"a*b"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8120ff92-2c41-47aa-8532-71023e593847",
"metadata": {},
"outputs": [],
"source": [
"a*b"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fdda4831-c06b-4d26-a85b-f80984297eb6",
"metadata": {},
"outputs": [],
"source": [
"a.shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "02cf979f-ec61-4e4f-acdd-e5eb58cb0a47",
"metadata": {},
"outputs": [],
"source": [
"a = a.cuda()\n",
"b = b.cuda()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7647aeeb-fb12-4e48-b918-626d1fc0b8c9",
"metadata": {},
"outputs": [],
"source": [
"a*b"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "82999836-a94d-47a7-84d4-a64e21875a7c",
"metadata": {},
"outputs": [],
"source": [
"x+y"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fffd9645-9c96-4ab5-a164-9f27b1a7351d",
"metadata": {},
"outputs": [],
"source": [
"a=tf.Variable(23)\n",
"b = tf.Variable(43)\n",
"a+b"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "92e6364d-9b94-4b5c-b1bd-f190b4db1a2f",
"metadata": {},
"outputs": [],
"source": [
"y"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "def66e08-effc-45a3-a203-dc5e833330c6",
"metadata": {},
"outputs": [],
"source": [
"x = tf.Variable([2,25,0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "97b7ec53-99c8-4873-9dfb-73a571faa3f8",
"metadata": {},
"outputs": [],
"source": [
"x[0]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c07d8817-c3a9-45cc-9408-894968d5f386",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "2e0724a1-1801-41cb-a3ec-2c70ad347b9e",
"metadata": {},
"outputs": [],
"source": [
"import torch"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "60ea0c4f-b977-4012-a4fb-679e31c4e477",
"metadata": {},
"outputs": [],
"source": [
"torch.tensor([1,2,3])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9f7ac01f-e881-417c-9e5e-1cf1ca239c48",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}