JBAujogue commited on
Commit
6e124c0
·
1 Parent(s): 1cbab28

add simple development notebook

Browse files
Files changed (1) hide show
  1. notebooks/dev.ipynb +110 -0
notebooks/dev.ipynb ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "9ef7f2cc",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "%load_ext autoreload\n",
11
+ "%autoreload 2"
12
+ ]
13
+ },
14
+ {
15
+ "cell_type": "code",
16
+ "execution_count": null,
17
+ "id": "5c1563c6",
18
+ "metadata": {},
19
+ "outputs": [],
20
+ "source": [
21
+ "import copy\n",
22
+ "\n",
23
+ "import torch"
24
+ ]
25
+ },
26
+ {
27
+ "cell_type": "code",
28
+ "execution_count": null,
29
+ "id": "6c8f9b12",
30
+ "metadata": {},
31
+ "outputs": [],
32
+ "source": [
33
+ "from rubik.cube import Cube\n",
34
+ "from rubik.action import build_actions_tensor"
35
+ ]
36
+ },
37
+ {
38
+ "cell_type": "code",
39
+ "execution_count": null,
40
+ "id": "6b3b066b",
41
+ "metadata": {},
42
+ "outputs": [],
43
+ "source": [
44
+ "size = 3\n",
45
+ "\n",
46
+ "actions = build_actions_tensor(size)\n",
47
+ "\n",
48
+ "cube = Cube.create([\"U\", \"L\", \"C\", \"R\", \"B\", \"D\"], size=size)\n",
49
+ "print(cube)"
50
+ ]
51
+ },
52
+ {
53
+ "cell_type": "code",
54
+ "execution_count": null,
55
+ "id": "de9308c5",
56
+ "metadata": {},
57
+ "outputs": [],
58
+ "source": [
59
+ "cubis = copy.deepcopy(cube)\n",
60
+ "cubis.shuffle(5000, seed=0)\n",
61
+ "print(cubis)\n",
62
+ "print(cubis.history)"
63
+ ]
64
+ },
65
+ {
66
+ "cell_type": "code",
67
+ "execution_count": null,
68
+ "id": "63dec5ee",
69
+ "metadata": {},
70
+ "outputs": [],
71
+ "source": [
72
+ "cubis = copy.deepcopy(cube)\n",
73
+ "cubis.rotate(\"X2 X1i Y1i Z1i Y0 Z0i X2 X1i Y1i Z1i Y0 Z0i \" * 1000)\n",
74
+ "print(cubis)\n",
75
+ "print(cubis.history)"
76
+ ]
77
+ },
78
+ {
79
+ "cell_type": "code",
80
+ "execution_count": null,
81
+ "id": "a8bc424f",
82
+ "metadata": {},
83
+ "outputs": [],
84
+ "source": [
85
+ "(actions[0, 2, 0].type(torch.FloatTensor) @ actions[0, 1, 1].type(torch.FloatTensor)).type(torch.int8)"
86
+ ]
87
+ }
88
+ ],
89
+ "metadata": {
90
+ "kernelspec": {
91
+ "display_name": "Rubik-Tensor",
92
+ "language": "python",
93
+ "name": "python3"
94
+ },
95
+ "language_info": {
96
+ "codemirror_mode": {
97
+ "name": "ipython",
98
+ "version": 3
99
+ },
100
+ "file_extension": ".py",
101
+ "mimetype": "text/x-python",
102
+ "name": "python",
103
+ "nbconvert_exporter": "python",
104
+ "pygments_lexer": "ipython3",
105
+ "version": "3.11.13"
106
+ }
107
+ },
108
+ "nbformat": 4,
109
+ "nbformat_minor": 5
110
+ }