Skip to content

Instantly share code, notes, and snippets.

@hopezh
Created February 7, 2021 13:36
Show Gist options
  • Save hopezh/3ea81d8bf71169865682ab28f8f999c8 to your computer and use it in GitHub Desktop.
Save hopezh/3ea81d8bf71169865682ab28f8f999c8 to your computer and use it in GitHub Desktop.
test notebook gist
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"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.7.4-final"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3.7.4 64-bit",
"metadata": {
"interpreter": {
"hash": "734c25f1dddaedb8b9bba2f649a8a093ffbd1259f7c9d6ab65bb2999aaac5917"
}
}
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import torch"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"tensor([[0.9672, 0.2479, 0.1008, 0.4450, 0.6202, 0.9538, 0.7583, 0.9702],\n",
" [0.0516, 0.1781, 0.9683, 0.8205, 0.6245, 0.6464, 0.9473, 0.1493],\n",
" [0.1046, 0.2402, 0.4190, 0.4587, 0.8884, 0.2851, 0.6582, 0.7962],\n",
" [0.1445, 0.4447, 0.2181, 0.5481, 0.5688, 0.7505, 0.0968, 0.3428],\n",
" [0.7179, 0.5586, 0.9876, 0.3671, 0.5281, 0.1759, 0.9024, 0.9538]])"
]
},
"metadata": {},
"execution_count": 2
}
],
"source": [
"x = torch.rand( 5 , 8 )\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"tensor([[1., 1., 1.],\n",
" [1., 1., 1.]])"
]
},
"metadata": {},
"execution_count": 3
}
],
"source": [
"y = torch.ones(2, 3)\n",
"y"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"cuda available: True\n"
]
}
],
"source": [
"print('cuda available: ' , torch.cuda.is_available() )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment