PyNorch/python/tests.ipynb
2024-04-26 00:56:47 -03:00

98 lines
2.1 KiB
Text

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0, 1, 2, 0, 2, 2] [2, 3, 3]\n",
"Tensor shape: [2, 3, 3]\n",
"Tensor created successfully\n",
"Tensor information:\n",
"Number of dimensions: 3\n",
"Shape: [2, 3, 3]\n",
"Data:\n",
"[0.00, 1.00, 2.00, 0.00, 2.00, 2.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00]\n"
]
}
],
"source": [
"from tensor import Tensor\n",
"\n",
"data = [[0, 1, 2], [0, 2, 2], [0, 1, 2]]\n",
"tensor = Tensor(data)\n",
"print(\"Tensor shape:\", tensor.shape)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tensor created successfully\n",
"Tensor information:\n",
"Number of dimensions: 2\n",
"Shape: [3, 3]\n",
"Data:\n",
"[0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90]\n"
]
},
{
"data": {
"text/plain": [
"0.10000000149011612 0.20000000298023224 0.30000001192092896 \n",
"0.4000000059604645 0.5 0.6000000238418579 \n",
"0.699999988079071 0.800000011920929 0.8999999761581421"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"data = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]\n",
"shape = [3, 3]\n",
"tensor = Tensor(data, shape)\n",
"tensor\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.9.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}