task_type
stringclasses
4 values
code_task
stringclasses
15 values
start_line
int64
4
1.79k
end_line
int64
4
1.8k
before
stringlengths
79
76.1k
between
stringlengths
17
806
after
stringlengths
2
72.6k
reason_categories_output
stringlengths
2
2.24k
horizon_categories_output
stringlengths
83
3.99k
reason_freq_analysis
stringclasses
150 values
horizon_freq_analysis
stringlengths
23
185
infilling_python
Image_Transformation
100
103
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' similarity_matrix = np.array([[scale_factor*costheta,scale_factor*sintheta,dx],', ' [-1*scale_factor*sintheta, scale_factor*costheta, dy],', ' [0,0,1]])', ' return similarity_matrix']
['', 'def affine(angle, x, y, scale, ax, ay):', ' scaling = np.array([[scale, 0,0], [0, scale, 0], [0,0,1]])', ' shear = np.array([[1, ax, 0], [ay, 1,0], [0, 0,1]])', ' result = np.array([[0,0,0], [0,0,0], [0,0,0]])', ' result = np.dot(translation(x, y), rotation(angle))', ' result = np.dot(result, scali...
[]
Library 'np' used at line 100 is imported at line 3 and has a Long-Range dependency. Variable 'scale_factor' used at line 100 is defined at line 94 and has a Short-Range dependency. Variable 'costheta' used at line 100 is defined at line 97 and has a Short-Range dependency. Variable 'sintheta' used at line 100 is defin...
{}
{'Library Long-Range': 1, 'Variable Short-Range': 9}
infilling_python
Image_Transformation
106
112
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' scaling = np.array([[scale, 0,0], [0, scale, 0], [0,0,1]])', ' shear = np.array([[1, ax, 0], [ay, 1,0], [0, 0,1]])', ' result = np.array([[0,0,0], [0,0,0], [0,0,0]])', ' result = np.dot(translation(x, y), rotation(angle))', ' result = np.dot(result, scaling)', ' result = np.dot(result, shear)', ' ...
['', 'def bilinear_interpolation(image,x,y):', ' x1 = int(x)', ' x2 = x1 + 1', ' y1 = int(y)', ' y2 = y1 + 1', '', ' if x1 < 0 or y1 < 0 or x2 >= image.shape[1] or y2 >= image.shape[0]:', ' return 0', ' else:', ' f11 = image[y1][x1]', ' f12 = image[y1][x2]', ' f21 = image[y...
[]
Library 'np' used at line 106 is imported at line 3 and has a Long-Range dependency. Variable 'scale' used at line 106 is defined at line 105 and has a Short-Range dependency. Library 'np' used at line 107 is imported at line 3 and has a Long-Range dependency. Variable 'ax' used at line 107 is defined at line 105 and h...
{}
{'Library Long-Range': 6, 'Variable Short-Range': 11, 'Function Medium-Range': 2}
infilling_python
Image_Transformation
106
106
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' scaling = np.array([[scale, 0,0], [0, scale, 0], [0,0,1]])']
[' shear = np.array([[1, ax, 0], [ay, 1,0], [0, 0,1]])', ' result = np.array([[0,0,0], [0,0,0], [0,0,0]])', ' result = np.dot(translation(x, y), rotation(angle))', ' result = np.dot(result, scaling)', ' result = np.dot(result, shear)', ' return result', '', 'def bilinear_interpolation(image,x,y):', ' ...
[]
Library 'np' used at line 106 is imported at line 3 and has a Long-Range dependency. Variable 'scale' used at line 106 is defined at line 105 and has a Short-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
Image_Transformation
107
107
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' shear = np.array([[1, ax, 0], [ay, 1,0], [0, 0,1]])']
[' result = np.array([[0,0,0], [0,0,0], [0,0,0]])', ' result = np.dot(translation(x, y), rotation(angle))', ' result = np.dot(result, scaling)', ' result = np.dot(result, shear)', ' return result', '', 'def bilinear_interpolation(image,x,y):', ' x1 = int(x)', ' x2 = x1 + 1', ' y1 = int(y)', ' ...
[]
Library 'np' used at line 107 is imported at line 3 and has a Long-Range dependency. Variable 'ax' used at line 107 is defined at line 105 and has a Short-Range dependency. Variable 'ay' used at line 107 is defined at line 105 and has a Short-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Short-Range': 2}
infilling_python
Image_Transformation
109
112
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' result = np.dot(translation(x, y), rotation(angle))', ' result = np.dot(result, scaling)', ' result = np.dot(result, shear)', ' return result']
['', 'def bilinear_interpolation(image,x,y):', ' x1 = int(x)', ' x2 = x1 + 1', ' y1 = int(y)', ' y2 = y1 + 1', '', ' if x1 < 0 or y1 < 0 or x2 >= image.shape[1] or y2 >= image.shape[0]:', ' return 0', ' else:', ' f11 = image[y1][x1]', ' f12 = image[y1][x2]', ' f21 = image[y...
[]
Library 'np' used at line 109 is imported at line 3 and has a Long-Range dependency. Function 'translation' used at line 109 is defined at line 82 and has a Medium-Range dependency. Variable 'x' used at line 109 is defined at line 105 and has a Short-Range dependency. Variable 'y' used at line 109 is defined at line 10...
{}
{'Library Long-Range': 3, 'Function Medium-Range': 2, 'Variable Short-Range': 8}
infilling_python
Image_Transformation
110
112
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' result = np.dot(result, scaling)', ' result = np.dot(result, shear)', ' return result']
['', 'def bilinear_interpolation(image,x,y):', ' x1 = int(x)', ' x2 = x1 + 1', ' y1 = int(y)', ' y2 = y1 + 1', '', ' if x1 < 0 or y1 < 0 or x2 >= image.shape[1] or y2 >= image.shape[0]:', ' return 0', ' else:', ' f11 = image[y1][x1]', ' f12 = image[y1][x2]', ' f21 = image[y...
[]
Library 'np' used at line 110 is imported at line 3 and has a Long-Range dependency. Variable 'scaling' used at line 110 is defined at line 106 and has a Short-Range dependency. Variable 'result' used at line 110 is defined at line 109 and has a Short-Range dependency. Library 'np' used at line 111 is imported at line ...
{}
{'Library Long-Range': 2, 'Variable Short-Range': 5}
infilling_python
Image_Transformation
117
118
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' y1 = int(y)', ' y2 = y1 + 1']
['', ' if x1 < 0 or y1 < 0 or x2 >= image.shape[1] or y2 >= image.shape[0]:', ' return 0', ' else:', ' f11 = image[y1][x1]', ' f12 = image[y1][x2]', ' f21 = image[y2][x1]', ' f22 = image[y2][x2]', '', ' w1 = (x2-x)*(y2-y)', ' w2 = (x-x1)*(y2-y)', ' w3 = (x2-...
[]
Variable 'y' used at line 117 is defined at line 114 and has a Short-Range dependency. Variable 'y1' used at line 118 is defined at line 117 and has a Short-Range dependency.
{}
{'Variable Short-Range': 2}
infilling_python
Image_Transformation
125
126
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' f21 = image[y2][x1]', ' f22 = image[y2][x2]']
['', ' w1 = (x2-x)*(y2-y)', ' w2 = (x-x1)*(y2-y)', ' w3 = (x2-x)*(y-y1)', ' w4 = (x-x1)*(y-y1)', '', ' return (w1*f11) + (w2*f12) + (w3*f21) + (w4*f22)', '', 'def image_warp(I,T):', ' rows,cols = I.shape[:2]', ' output = np.zeros((rows,cols,3))', ' center = (cols/2, rows/2)', ' ...
[{'reason_category': 'Else Reasoning', 'usage_line': 125}, {'reason_category': 'Else Reasoning', 'usage_line': 126}]
Variable 'image' used at line 125 is defined at line 114 and has a Medium-Range dependency. Variable 'y2' used at line 125 is defined at line 118 and has a Short-Range dependency. Variable 'x1' used at line 125 is defined at line 115 and has a Short-Range dependency. Variable 'image' used at line 126 is defined at line...
{'Else Reasoning': 2}
{'Variable Medium-Range': 2, 'Variable Short-Range': 4}
infilling_python
Image_Transformation
129
131
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' w2 = (x-x1)*(y2-y)', ' w3 = (x2-x)*(y-y1)', ' w4 = (x-x1)*(y-y1)']
['', ' return (w1*f11) + (w2*f12) + (w3*f21) + (w4*f22)', '', 'def image_warp(I,T):', ' rows,cols = I.shape[:2]', ' output = np.zeros((rows,cols,3))', ' center = (cols/2, rows/2)', ' T_invert = np.linalg.inv(T)', '', ' for i in range(rows):', ' for j in range(cols):', ' shift_center ...
[{'reason_category': 'Else Reasoning', 'usage_line': 129}, {'reason_category': 'Else Reasoning', 'usage_line': 130}, {'reason_category': 'Else Reasoning', 'usage_line': 131}]
Variable 'x' used at line 129 is defined at line 114 and has a Medium-Range dependency. Variable 'x1' used at line 129 is defined at line 115 and has a Medium-Range dependency. Variable 'y2' used at line 129 is defined at line 118 and has a Medium-Range dependency. Variable 'y' used at line 129 is defined at line 114 a...
{'Else Reasoning': 3}
{'Variable Medium-Range': 12}
infilling_python
Image_Transformation
133
133
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' return (w1*f11) + (w2*f12) + (w3*f21) + (w4*f22)']
['', 'def image_warp(I,T):', ' rows,cols = I.shape[:2]', ' output = np.zeros((rows,cols,3))', ' center = (cols/2, rows/2)', ' T_invert = np.linalg.inv(T)', '', ' for i in range(rows):', ' for j in range(cols):', ' shift_center = np.array([j-center[0],i -center[1],1])', ' coor...
[]
Variable 'w1' used at line 133 is defined at line 128 and has a Short-Range dependency. Variable 'f11' used at line 133 is defined at line 123 and has a Short-Range dependency. Variable 'w2' used at line 133 is defined at line 129 and has a Short-Range dependency. Variable 'f12' used at line 133 is defined at line 124 ...
{}
{'Variable Short-Range': 8}
infilling_python
Image_Transformation
136
148
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' rows,cols = I.shape[:2]', ' output = np.zeros((rows,cols,3))', ' center = (cols/2, rows/2)', ' T_invert = np.linalg.inv(T)', '', ' for i in range(rows):', ' for j in range(cols):', ' shift_center = np.array([j-center[0],i -center[1],1])', ' coordinates = np.dot(T_invert,sh...
['', "path= './arabella.jpg'", 'arabella = cv2.imread(path)', 'arabella_smol = cv2.resize(arabella, dsize=(256, 192), interpolation=cv2.INTER_AREA)', 'arabella_smol = np.array(arabella_smol)', 'arabella_smol = arabella_smol[:, :, [2, 1, 0]]', '', '#translate images keep params as shown', 't1 = translation(21,25)', 'war...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 141}, {'reason_category': 'Loop Body', 'usage_line': 142}, {'reason_category': 'Define Stop Criteria', 'usage_line': 142}, {'reason_category': 'Loop Body', 'usage_line': 143}, {'reason_category': 'Loop Body', 'usage_line': 144}, {'reason_category': 'Loop Body',...
Variable 'I' used at line 136 is defined at line 135 and has a Short-Range dependency. Library 'np' used at line 137 is imported at line 3 and has a Long-Range dependency. Variable 'rows' used at line 137 is defined at line 136 and has a Short-Range dependency. Variable 'cols' used at line 137 is defined at line 136 an...
{'Define Stop Criteria': 2, 'Loop Body': 5}
{'Variable Short-Range': 18, 'Library Long-Range': 5, 'Variable Loop Short-Range': 4, 'Function Long-Range': 1, 'Variable Medium-Range': 1}
infilling_python
Image_Transformation
138
138
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' center = (cols/2, rows/2)']
[' T_invert = np.linalg.inv(T)', '', ' for i in range(rows):', ' for j in range(cols):', ' shift_center = np.array([j-center[0],i -center[1],1])', ' coordinates = np.dot(T_invert,shift_center)', ' x,y = coordinates[0] + center[0], coordinates [1] + center[1]', ' ...
[]
Variable 'cols' used at line 138 is defined at line 136 and has a Short-Range dependency. Variable 'rows' used at line 138 is defined at line 136 and has a Short-Range dependency.
{}
{'Variable Short-Range': 2}
infilling_python
Image_Transformation
139
139
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' T_invert = np.linalg.inv(T)']
['', ' for i in range(rows):', ' for j in range(cols):', ' shift_center = np.array([j-center[0],i -center[1],1])', ' coordinates = np.dot(T_invert,shift_center)', ' x,y = coordinates[0] + center[0], coordinates [1] + center[1]', ' output[i][j] = bilinear_interpolati...
[]
Library 'np' used at line 139 is imported at line 3 and has a Long-Range dependency. Variable 'T' used at line 139 is defined at line 135 and has a Short-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
Image_Transformation
143
148
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' shift_center = np.array([j-center[0],i -center[1],1])', ' coordinates = np.dot(T_invert,shift_center)', ' x,y = coordinates[0] + center[0], coordinates [1] + center[1]', ' output[i][j] = bilinear_interpolation(I,x,y)', ' output = np.array(output, np.uint8)', ' return...
['', "path= './arabella.jpg'", 'arabella = cv2.imread(path)', 'arabella_smol = cv2.resize(arabella, dsize=(256, 192), interpolation=cv2.INTER_AREA)', 'arabella_smol = np.array(arabella_smol)', 'arabella_smol = arabella_smol[:, :, [2, 1, 0]]', '', '#translate images keep params as shown', 't1 = translation(21,25)', 'war...
[{'reason_category': 'Loop Body', 'usage_line': 143}, {'reason_category': 'Loop Body', 'usage_line': 144}, {'reason_category': 'Loop Body', 'usage_line': 145}, {'reason_category': 'Loop Body', 'usage_line': 146}]
Library 'np' used at line 143 is imported at line 3 and has a Long-Range dependency. Variable 'j' used at line 143 is part of a Loop defined at line 142 and has a Short-Range dependency. Variable 'center' used at line 143 is defined at line 138 and has a Short-Range dependency. Variable 'i' used at line 143 is part of ...
{'Loop Body': 4}
{'Library Long-Range': 3, 'Variable Loop Short-Range': 4, 'Variable Short-Range': 10, 'Function Long-Range': 1, 'Variable Medium-Range': 1}
infilling_python
Image_Transformation
143
143
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' shift_center = np.array([j-center[0],i -center[1],1])']
[' coordinates = np.dot(T_invert,shift_center)', ' x,y = coordinates[0] + center[0], coordinates [1] + center[1]', ' output[i][j] = bilinear_interpolation(I,x,y)', ' output = np.array(output, np.uint8)', ' return output', '', "path= './arabella.jpg'", 'arabella = cv2.imread(path)'...
[{'reason_category': 'Loop Body', 'usage_line': 143}]
Library 'np' used at line 143 is imported at line 3 and has a Long-Range dependency. Variable 'j' used at line 143 is part of a Loop defined at line 142 and has a Short-Range dependency. Variable 'center' used at line 143 is defined at line 138 and has a Short-Range dependency. Variable 'i' used at line 143 is part of ...
{'Loop Body': 1}
{'Library Long-Range': 1, 'Variable Loop Short-Range': 2, 'Variable Short-Range': 1}
infilling_python
Image_Transformation
144
144
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' coordinates = np.dot(T_invert,shift_center)']
[' x,y = coordinates[0] + center[0], coordinates [1] + center[1]', ' output[i][j] = bilinear_interpolation(I,x,y)', ' output = np.array(output, np.uint8)', ' return output', '', "path= './arabella.jpg'", 'arabella = cv2.imread(path)', 'arabella_smol = cv2.resize(arabella, dsize=(256, 192), i...
[{'reason_category': 'Loop Body', 'usage_line': 144}]
Library 'np' used at line 144 is imported at line 3 and has a Long-Range dependency. Variable 'T_invert' used at line 144 is defined at line 139 and has a Short-Range dependency. Variable 'shift_center' used at line 144 is defined at line 143 and has a Short-Range dependency.
{'Loop Body': 1}
{'Library Long-Range': 1, 'Variable Short-Range': 2}
infilling_python
Image_Transformation
145
145
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' x,y = coordinates[0] + center[0], coordinates [1] + center[1]']
[' output[i][j] = bilinear_interpolation(I,x,y)', ' output = np.array(output, np.uint8)', ' return output', '', "path= './arabella.jpg'", 'arabella = cv2.imread(path)', 'arabella_smol = cv2.resize(arabella, dsize=(256, 192), interpolation=cv2.INTER_AREA)', 'arabella_smol = np.array(arabella_smol)', 'ar...
[{'reason_category': 'Loop Body', 'usage_line': 145}]
Variable 'coordinates' used at line 145 is defined at line 144 and has a Short-Range dependency. Variable 'center' used at line 145 is defined at line 138 and has a Short-Range dependency.
{'Loop Body': 1}
{'Variable Short-Range': 2}
infilling_python
Image_Transformation
146
146
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' output[i][j] = bilinear_interpolation(I,x,y)']
[' output = np.array(output, np.uint8)', ' return output', '', "path= './arabella.jpg'", 'arabella = cv2.imread(path)', 'arabella_smol = cv2.resize(arabella, dsize=(256, 192), interpolation=cv2.INTER_AREA)', 'arabella_smol = np.array(arabella_smol)', 'arabella_smol = arabella_smol[:, :, [2, 1, 0]]', '', '#transla...
[{'reason_category': 'Loop Body', 'usage_line': 146}]
Variable 'output' used at line 146 is defined at line 137 and has a Short-Range dependency. Variable 'i' used at line 146 is part of a Loop defined at line 141 and has a Short-Range dependency. Variable 'j' used at line 146 is part of a Loop defined at line 142 and has a Short-Range dependency. Function 'bilinear_inter...
{'Loop Body': 1}
{'Variable Short-Range': 3, 'Variable Loop Short-Range': 2, 'Function Long-Range': 1, 'Variable Medium-Range': 1}
infilling_python
Image_Transformation
143
146
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
[' shift_center = np.array([j-center[0],i -center[1],1])', ' coordinates = np.dot(T_invert,shift_center)', ' x,y = coordinates[0] + center[0], coordinates [1] + center[1]', ' output[i][j] = bilinear_interpolation(I,x,y)']
[' output = np.array(output, np.uint8)', ' return output', '', "path= './arabella.jpg'", 'arabella = cv2.imread(path)', 'arabella_smol = cv2.resize(arabella, dsize=(256, 192), interpolation=cv2.INTER_AREA)', 'arabella_smol = np.array(arabella_smol)', 'arabella_smol = arabella_smol[:, :, [2, 1, 0]]', '', '#transla...
[{'reason_category': 'Loop Body', 'usage_line': 143}, {'reason_category': 'Loop Body', 'usage_line': 144}, {'reason_category': 'Loop Body', 'usage_line': 145}, {'reason_category': 'Loop Body', 'usage_line': 146}]
Library 'np' used at line 143 is imported at line 3 and has a Long-Range dependency. Variable 'j' used at line 143 is part of a Loop defined at line 142 and has a Short-Range dependency. Variable 'center' used at line 143 is defined at line 138 and has a Short-Range dependency. Variable 'i' used at line 143 is part of ...
{'Loop Body': 4}
{'Library Long-Range': 2, 'Variable Loop Short-Range': 4, 'Variable Short-Range': 8, 'Function Long-Range': 1, 'Variable Medium-Range': 1}
infilling_python
Image_Transformation
160
160
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
['warped_arabella2 = image_warp(arabella_smol,t2)']
['t3 = translation(21,-25)', 'warped_arabella3 = image_warp(arabella_smol,t3)', 't4 = translation(-21,25)', 'warped_arabella4 = image_warp(arabella_smol,t4)', 'print(warped_arabella1)', 'print(warped_arabella2)', 'print(warped_arabella3)', 'print(warped_arabella4)', '', '# rotate image 30 degrees clockwise and 30 degre...
[]
Function 'image_warp' used at line 160 is defined at line 135 and has a Medium-Range dependency. Variable 'arabella_smol' used at line 160 is defined at line 154 and has a Short-Range dependency. Variable 't2' used at line 160 is defined at line 159 and has a Short-Range dependency.
{}
{'Function Medium-Range': 1, 'Variable Short-Range': 2}
infilling_python
Image_Transformation
164
164
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
['warped_arabella4 = image_warp(arabella_smol,t4)']
['print(warped_arabella1)', 'print(warped_arabella2)', 'print(warped_arabella3)', 'print(warped_arabella4)', '', '# rotate image 30 degrees clockwise and 30 degrees counterclockwise', 'r1 = rotation(30, False)', 'r2 = rotation(-30, False)', '', 'warped_arabella5 = image_warp(arabella_smol,r1)', 'warped_arabella6 = imag...
[]
Function 'image_warp' used at line 164 is defined at line 135 and has a Medium-Range dependency. Variable 'arabella_smol' used at line 164 is defined at line 154 and has a Short-Range dependency. Variable 't4' used at line 164 is defined at line 163 and has a Short-Range dependency.
{}
{'Function Medium-Range': 1, 'Variable Short-Range': 2}
infilling_python
Image_Transformation
171
172
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
['r1 = rotation(30, False)', 'r2 = rotation(-30, False)']
['', 'warped_arabella5 = image_warp(arabella_smol,r1)', 'warped_arabella6 = image_warp(arabella_smol,r2)', 'print(warped_arabella5)', 'print(warped_arabella6)', '', '#apply similarity transformation to image, keep params as shown below', 's1 = similarity_matrix(60, 0, 0, 0.5,radians=False)', 'warped_arabella7 = image_w...
[]
Function 'rotation' used at line 171 is defined at line 86 and has a Long-Range dependency. Function 'rotation' used at line 172 is defined at line 86 and has a Long-Range dependency.
{}
{'Function Long-Range': 2}
infilling_python
Image_Transformation
172
172
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
['r2 = rotation(-30, False)']
['', 'warped_arabella5 = image_warp(arabella_smol,r1)', 'warped_arabella6 = image_warp(arabella_smol,r2)', 'print(warped_arabella5)', 'print(warped_arabella6)', '', '#apply similarity transformation to image, keep params as shown below', 's1 = similarity_matrix(60, 0, 0, 0.5,radians=False)', 'warped_arabella7 = image_w...
[]
Function 'rotation' used at line 172 is defined at line 86 and has a Long-Range dependency.
{}
{'Function Long-Range': 1}
infilling_python
Image_Transformation
175
175
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
['warped_arabella6 = image_warp(arabella_smol,r2)']
['print(warped_arabella5)', 'print(warped_arabella6)', '', '#apply similarity transformation to image, keep params as shown below', 's1 = similarity_matrix(60, 0, 0, 0.5,radians=False)', 'warped_arabella7 = image_warp(arabella_smol,s1)', 'print(warped_arabella7)', '', '#apply affine transformation to image, keep params...
[]
Function 'image_warp' used at line 175 is defined at line 135 and has a Long-Range dependency. Variable 'arabella_smol' used at line 175 is defined at line 154 and has a Medium-Range dependency. Variable 'r2' used at line 175 is defined at line 172 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Medium-Range': 1, 'Variable Short-Range': 1}
infilling_python
Image_Transformation
181
181
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
['warped_arabella7 = image_warp(arabella_smol,s1)']
['print(warped_arabella7)', '', '#apply affine transformation to image, keep params as shown below', 'a1 = affine(90, 2, 3, .5, 5, 2)', 'warped_arabella8 = image_warp(arabella_smol,a1)', 'print(warped_arabella8)', '', '#Task 4:', '#artificially replicate overhead and desklight scene via addition of overhead lit only an...
[]
Function 'image_warp' used at line 181 is defined at line 135 and has a Long-Range dependency. Variable 'arabella_smol' used at line 181 is defined at line 154 and has a Medium-Range dependency. Variable 's1' used at line 181 is defined at line 180 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Medium-Range': 1, 'Variable Short-Range': 1}
infilling_python
Image_Transformation
186
186
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
['warped_arabella8 = image_warp(arabella_smol,a1)']
['print(warped_arabella8)', '', '#Task 4:', '#artificially replicate overhead and desklight scene via addition of overhead lit only and desklight lit only scenes', '#make sure to scale properly ', "path1= './desklight.jpg'", "path2= './overheadlight.jpg'", "path3 = './bothlight.jpg'", 'I1 = np.array(cv2.imread(path1))[...
[]
Function 'image_warp' used at line 186 is defined at line 135 and has a Long-Range dependency. Variable 'arabella_smol' used at line 186 is defined at line 154 and has a Long-Range dependency. Variable 'a1' used at line 186 is defined at line 185 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
Image_Transformation
207
207
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
['synthI12 = I1+I2']
['diffI = synthI12 - I12', 'diffI_scaled = (diffI - np.min(diffI))/(np.max(diffI)-np.min(diffI))', '', 'print(I12)', 'print(synthI12)', 'print(diffI_scaled)']
[]
Variable 'I1' used at line 207 is defined at line 195 and has a Medium-Range dependency. Variable 'I2' used at line 207 is defined at line 196 and has a Medium-Range dependency.
{}
{'Variable Medium-Range': 2}
infilling_python
Image_Transformation
208
208
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
['diffI = synthI12 - I12']
['diffI_scaled = (diffI - np.min(diffI))/(np.max(diffI)-np.min(diffI))', '', 'print(I12)', 'print(synthI12)', 'print(diffI_scaled)']
[]
Variable 'synthI12' used at line 208 is defined at line 207 and has a Short-Range dependency. Variable 'I12' used at line 208 is defined at line 197 and has a Medium-Range dependency.
{}
{'Variable Short-Range': 1, 'Variable Medium-Range': 1}
infilling_python
Image_Transformation
209
209
['from PIL import Image', 'import cv2', 'import numpy as np', 'import matplotlib.pyplot as plt', '', '#Task 1:', '#resize two imgs', '#resize imgA with cv2.resize', '#resize imgB via center cropping', '#ensure both resized images are resized to same end_size', '#concatenate the resized imgs via every other row imgA and...
['diffI_scaled = (diffI - np.min(diffI))/(np.max(diffI)-np.min(diffI))']
['', 'print(I12)', 'print(synthI12)', 'print(diffI_scaled)']
[]
Variable 'diffI' used at line 209 is defined at line 208 and has a Short-Range dependency. Library 'np' used at line 209 is imported at line 3 and has a Long-Range dependency.
{}
{'Variable Short-Range': 1, 'Library Long-Range': 1}
infilling_python
RL_Motion_Planning
43
44
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
['script_path = os.path.realpath(__file__)', 'script_dir = os.path.dirname(script_path)']
['', "log_dir = os.path.join(script_dir, './logging', 'BC', 'run' + current_time)", 'if not os.path.exists(log_dir):', ' os.makedirs(log_dir, exist_ok=True)', '', "logging.basicConfig(filename=os.path.join(log_dir, 'logs.txt'), filemode='w',", " format='%(asctime)s - %(levelname)s - %(name)s - %...
[]
Library 'os' used at line 43 is imported at line 8 and has a Long-Range dependency. Library 'os' used at line 44 is imported at line 8 and has a Long-Range dependency. Variable 'script_path' used at line 44 is defined at line 43 and has a Short-Range dependency.
{}
{'Library Long-Range': 2, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
48
48
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' os.makedirs(log_dir, exist_ok=True)']
['', "logging.basicConfig(filename=os.path.join(log_dir, 'logs.txt'), filemode='w',", " format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',", " datefmt='%m/%d/%Y %H:%M:%S',", ' level=logging.INFO)', 'logger = logging.getLogger(__name__)', '', '', 'de...
[{'reason_category': 'If Body', 'usage_line': 48}]
Library 'os' used at line 48 is imported at line 8 and has a Long-Range dependency. Variable 'log_dir' used at line 48 is defined at line 46 and has a Short-Range dependency.
{'If Body': 1}
{'Library Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
83
83
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' goals = tf.map_fn(lambda x: x[3: 3 + num_objs * 3], states, fn_output_signature=tf.float32)']
[' return goals', ' ', ' return get_goal', '', '', 'def repurpose_skill_seq(args, skill_seq):', ' """', ' Repurpose the skill sequence to be used for training the policy. Use value of wrap_skill_id', ' = "0": no change', ' = "1": wrap pick/grab/drop:obj_id to pick/grab/drop', ' = "2": wrap p...
[{'reason_category': 'Lambda_Expressions', 'usage_line': 83}]
Library 'tf' used at line 83 is imported at line 20 and has a Long-Range dependency. Variable 'x' used at line 83 is part of a Lambda_Expressions defined at line 83 and has a Short-Range dependency. Variable 'num_objs' used at line 83 is defined at line 74 and has a Short-Range dependency. Variable 'states' used at lin...
{'Lambda_Expressions': 1}
{'Library Long-Range': 1, 'Variable Lambda_Expressions Short-Range': 1, 'Variable Short-Range': 2}
infilling_python
RL_Motion_Planning
104
117
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' elif args.wrap_level == "1":', ' # wrap by i = j % 3 where i is the new position of skill originally at j. Dim changes from c_dim to 3', ' skill_seq = tf.argmax(skill_seq, axis=-1)', ' skill_seq = skill_seq % 3', ' # Convert back to one-hot', ' skill_seq = tf.one_hot(skill_seq, ...
[' else:', ' raise NotImplementedError("Invalid value for wrap_skill_id: {}".format(args.wrap_level))', '', '', 'def orthogonal_regularization(model, reg_coef=1e-4):', ' """Orthogonal regularization v2.', ' See equation (3) in https://arxiv.org/abs/1809.11096.', ' Rβ(W) = β∥W⊤W ⊙ (1 − I)∥2F, ...
[{'reason_category': 'Elif Condition', 'usage_line': 104}, {'reason_category': 'Elif Body', 'usage_line': 105}, {'reason_category': 'Elif Body', 'usage_line': 106}, {'reason_category': 'Elif Body', 'usage_line': 107}, {'reason_category': 'Elif Body', 'usage_line': 108}, {'reason_category': 'Elif Body', 'usage_line': 10...
Variable 'args' used at line 104 is defined at line 89 and has a Medium-Range dependency. Library 'tf' used at line 106 is imported at line 20 and has a Long-Range dependency. Variable 'skill_seq' used at line 106 is defined at line 89 and has a Medium-Range dependency. Variable 'skill_seq' used at line 107 is defined ...
{'Elif Condition': 2, 'Elif Body': 12}
{'Variable Medium-Range': 5, 'Library Long-Range': 4, 'Variable Short-Range': 6}
infilling_python
RL_Motion_Planning
103
103
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' return skill_seq']
[' elif args.wrap_level == "1":', ' # wrap by i = j % 3 where i is the new position of skill originally at j. Dim changes from c_dim to 3', ' skill_seq = tf.argmax(skill_seq, axis=-1)', ' skill_seq = skill_seq % 3', ' # Convert back to one-hot', ' skill_seq = tf.one_hot(skill_seq, ...
[{'reason_category': 'If Body', 'usage_line': 103}]
Variable 'skill_seq' used at line 103 is defined at line 89 and has a Medium-Range dependency.
{'If Body': 1}
{'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
104
104
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' elif args.wrap_level == "1":']
[' # wrap by i = j % 3 where i is the new position of skill originally at j. Dim changes from c_dim to 3', ' skill_seq = tf.argmax(skill_seq, axis=-1)', ' skill_seq = skill_seq % 3', ' # Convert back to one-hot', ' skill_seq = tf.one_hot(skill_seq, depth=3)', ' return skill_seq...
[{'reason_category': 'Elif Condition', 'usage_line': 104}]
Variable 'args' used at line 104 is defined at line 89 and has a Medium-Range dependency.
{'Elif Condition': 1}
{'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
106
107
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' skill_seq = tf.argmax(skill_seq, axis=-1)', ' skill_seq = skill_seq % 3']
[' # Convert back to one-hot', ' skill_seq = tf.one_hot(skill_seq, depth=3)', ' return skill_seq', ' elif args.wrap_level == "2":', ' # wrap such that 0/1/2 -> 0, 3/4/5 -> 1, 6/7/8 -> 2 ... Dim changes from c_dim to self.args.num_objs', ' skill_seq = tf.argmax(skill_seq, axis=-1)',...
[{'reason_category': 'Elif Body', 'usage_line': 106}, {'reason_category': 'Elif Body', 'usage_line': 107}]
Library 'tf' used at line 106 is imported at line 20 and has a Long-Range dependency. Variable 'skill_seq' used at line 106 is defined at line 89 and has a Medium-Range dependency. Variable 'skill_seq' used at line 107 is defined at line 106 and has a Short-Range dependency.
{'Elif Body': 2}
{'Library Long-Range': 1, 'Variable Medium-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
109
109
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' skill_seq = tf.one_hot(skill_seq, depth=3)']
[' return skill_seq', ' elif args.wrap_level == "2":', ' # wrap such that 0/1/2 -> 0, 3/4/5 -> 1, 6/7/8 -> 2 ... Dim changes from c_dim to self.args.num_objs', ' skill_seq = tf.argmax(skill_seq, axis=-1)', ' skill_seq = skill_seq // 3', ' # Convert back to one-hot', ' skill_...
[{'reason_category': 'Elif Body', 'usage_line': 109}]
Variable 'skill_seq' used at line 109 is defined at line 107 and has a Short-Range dependency. Library 'tf' used at line 109 is imported at line 20 and has a Long-Range dependency.
{'Elif Body': 1}
{'Variable Short-Range': 1, 'Library Long-Range': 1}
infilling_python
RL_Motion_Planning
111
111
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' elif args.wrap_level == "2":']
[' # wrap such that 0/1/2 -> 0, 3/4/5 -> 1, 6/7/8 -> 2 ... Dim changes from c_dim to self.args.num_objs', ' skill_seq = tf.argmax(skill_seq, axis=-1)', ' skill_seq = skill_seq // 3', ' # Convert back to one-hot', ' skill_seq = tf.one_hot(skill_seq, depth=args.num_objs)', ' retu...
[{'reason_category': 'Elif Condition', 'usage_line': 111}]
Variable 'args' used at line 111 is defined at line 89 and has a Medium-Range dependency.
{'Elif Condition': 1}
{'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
113
114
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' skill_seq = tf.argmax(skill_seq, axis=-1)', ' skill_seq = skill_seq // 3']
[' # Convert back to one-hot', ' skill_seq = tf.one_hot(skill_seq, depth=args.num_objs)', ' return skill_seq', ' else:', ' raise NotImplementedError("Invalid value for wrap_skill_id: {}".format(args.wrap_level))', '', '', 'def orthogonal_regularization(model, reg_coef=1e-4):', ' """Ort...
[{'reason_category': 'Elif Body', 'usage_line': 113}, {'reason_category': 'Elif Body', 'usage_line': 114}]
Library 'tf' used at line 113 is imported at line 20 and has a Long-Range dependency. Variable 'skill_seq' used at line 113 is defined at line 89 and has a Medium-Range dependency. Variable 'skill_seq' used at line 114 is defined at line 113 and has a Short-Range dependency.
{'Elif Body': 2}
{'Library Long-Range': 1, 'Variable Medium-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
116
116
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' skill_seq = tf.one_hot(skill_seq, depth=args.num_objs)']
[' return skill_seq', ' else:', ' raise NotImplementedError("Invalid value for wrap_skill_id: {}".format(args.wrap_level))', '', '', 'def orthogonal_regularization(model, reg_coef=1e-4):', ' """Orthogonal regularization v2.', ' See equation (3) in https://arxiv.org/abs/1809.11096.', ' ...
[{'reason_category': 'Elif Body', 'usage_line': 116}]
Variable 'skill_seq' used at line 116 is defined at line 114 and has a Short-Range dependency. Library 'tf' used at line 116 is imported at line 20 and has a Long-Range dependency. Variable 'args' used at line 116 is defined at line 89 and has a Medium-Range dependency.
{'Elif Body': 1}
{'Variable Short-Range': 1, 'Library Long-Range': 1, 'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
103
117
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' return skill_seq', ' elif args.wrap_level == "1":', ' # wrap by i = j % 3 where i is the new position of skill originally at j. Dim changes from c_dim to 3', ' skill_seq = tf.argmax(skill_seq, axis=-1)', ' skill_seq = skill_seq % 3', ' # Convert back to one-hot', ' skill_...
[' else:', ' raise NotImplementedError("Invalid value for wrap_skill_id: {}".format(args.wrap_level))', '', '', 'def orthogonal_regularization(model, reg_coef=1e-4):', ' """Orthogonal regularization v2.', ' See equation (3) in https://arxiv.org/abs/1809.11096.', ' Rβ(W) = β∥W⊤W ⊙ (1 − I)∥2F, ...
[{'reason_category': 'If Body', 'usage_line': 103}, {'reason_category': 'Elif Condition', 'usage_line': 104}, {'reason_category': 'Elif Body', 'usage_line': 105}, {'reason_category': 'Elif Body', 'usage_line': 106}, {'reason_category': 'Elif Body', 'usage_line': 107}, {'reason_category': 'Elif Body', 'usage_line': 108}...
Variable 'skill_seq' used at line 103 is defined at line 89 and has a Medium-Range dependency. Variable 'args' used at line 104 is defined at line 89 and has a Medium-Range dependency. Library 'tf' used at line 106 is imported at line 20 and has a Long-Range dependency. Variable 'skill_seq' used at line 106 is defined ...
{'If Body': 1, 'Elif Condition': 2, 'Elif Body': 12}
{'Variable Medium-Range': 6, 'Library Long-Range': 4, 'Variable Short-Range': 6}
infilling_python
RL_Motion_Planning
132
139
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' reg = 0', ' for layer in model.layers:', ' if isinstance(layer, tf.keras.layers.Dense):', ' prod = tf.matmul(tf.transpose(layer.kernel), layer.kernel)', ' reg += tf.reduce_sum(tf.math.square(prod * (1 - tf.eye(prod.shape[0]))))', ' ', ' print("Orthogonal Regularization: {}".f...
['', '', 'def sample_transitions(sample_style: str, state_to_goal=None, num_options: int = None):', ' def sample_random_transitions(episodic_data, batch_size_in_transitions=None):', ' """', ' Sample random transitions without HER.', ' Functionality: Sample random time-steps from each episode: (g...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 133}, {'reason_category': 'Loop Body', 'usage_line': 134}, {'reason_category': 'If Condition', 'usage_line': 134}, {'reason_category': 'Loop Body', 'usage_line': 135}, {'reason_category': 'If Body', 'usage_line': 135}, {'reason_category': 'Loop Body', 'usage_li...
Variable 'model' used at line 133 is defined at line 122 and has a Medium-Range dependency. Variable 'layer' used at line 134 is part of a Loop defined at line 133 and has a Short-Range dependency. Library 'tf' used at line 134 is imported at line 20 and has a Long-Range dependency. Library 'tf' used at line 135 is imp...
{'Define Stop Criteria': 1, 'Loop Body': 3, 'If Condition': 1, 'If Body': 2}
{'Variable Medium-Range': 3, 'Variable Loop Short-Range': 2, 'Library Long-Range': 3, 'Variable Short-Range': 4}
infilling_python
RL_Motion_Planning
134
139
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' if isinstance(layer, tf.keras.layers.Dense):', ' prod = tf.matmul(tf.transpose(layer.kernel), layer.kernel)', ' reg += tf.reduce_sum(tf.math.square(prod * (1 - tf.eye(prod.shape[0]))))', ' ', ' print("Orthogonal Regularization: {}".format(reg * reg_coef))', ' return reg * reg_co...
['', '', 'def sample_transitions(sample_style: str, state_to_goal=None, num_options: int = None):', ' def sample_random_transitions(episodic_data, batch_size_in_transitions=None):', ' """', ' Sample random transitions without HER.', ' Functionality: Sample random time-steps from each episode: (g...
[{'reason_category': 'Loop Body', 'usage_line': 134}, {'reason_category': 'If Condition', 'usage_line': 134}, {'reason_category': 'Loop Body', 'usage_line': 135}, {'reason_category': 'If Body', 'usage_line': 135}, {'reason_category': 'Loop Body', 'usage_line': 136}, {'reason_category': 'If Body', 'usage_line': 136}]
Variable 'layer' used at line 134 is part of a Loop defined at line 133 and has a Short-Range dependency. Library 'tf' used at line 134 is imported at line 20 and has a Long-Range dependency. Library 'tf' used at line 135 is imported at line 20 and has a Long-Range dependency. Variable 'layer' used at line 135 is part ...
{'Loop Body': 3, 'If Condition': 1, 'If Body': 2}
{'Variable Loop Short-Range': 2, 'Library Long-Range': 3, 'Variable Short-Range': 4, 'Variable Medium-Range': 2}
infilling_python
RL_Motion_Planning
134
136
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' if isinstance(layer, tf.keras.layers.Dense):', ' prod = tf.matmul(tf.transpose(layer.kernel), layer.kernel)', ' reg += tf.reduce_sum(tf.math.square(prod * (1 - tf.eye(prod.shape[0]))))']
[' ', ' print("Orthogonal Regularization: {}".format(reg * reg_coef))', ' return reg * reg_coef', '', '', 'def sample_transitions(sample_style: str, state_to_goal=None, num_options: int = None):', ' def sample_random_transitions(episodic_data, batch_size_in_transitions=None):', ' """', ' Sampl...
[{'reason_category': 'Loop Body', 'usage_line': 134}, {'reason_category': 'If Condition', 'usage_line': 134}, {'reason_category': 'Loop Body', 'usage_line': 135}, {'reason_category': 'If Body', 'usage_line': 135}, {'reason_category': 'Loop Body', 'usage_line': 136}, {'reason_category': 'If Body', 'usage_line': 136}]
Variable 'layer' used at line 134 is part of a Loop defined at line 133 and has a Short-Range dependency. Library 'tf' used at line 134 is imported at line 20 and has a Long-Range dependency. Library 'tf' used at line 135 is imported at line 20 and has a Long-Range dependency. Variable 'layer' used at line 135 is part ...
{'Loop Body': 3, 'If Condition': 1, 'If Body': 2}
{'Variable Loop Short-Range': 2, 'Library Long-Range': 3, 'Variable Short-Range': 2}
infilling_python
RL_Motion_Planning
139
139
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' return reg * reg_coef']
['', '', 'def sample_transitions(sample_style: str, state_to_goal=None, num_options: int = None):', ' def sample_random_transitions(episodic_data, batch_size_in_transitions=None):', ' """', ' Sample random transitions without HER.', ' Functionality: Sample random time-steps from each episode: (g...
[]
Variable 'reg' used at line 139 is defined at line 132 and has a Short-Range dependency. Variable 'reg_coef' used at line 139 is defined at line 122 and has a Medium-Range dependency.
{}
{'Variable Short-Range': 1, 'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
154
154
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' terminate_idxes = tf.math.argmax(successes, axis=-1)']
[' # If no success, set to last index', ' mask_no_success = tf.math.equal(terminate_idxes, 0)', ' terminate_idxes += tf.multiply((T - 1) * tf.ones_like(terminate_idxes),', ' tf.cast(mask_no_success, terminate_idxes.dtype))', ' ', " # Get episode i...
[]
Library 'tf' used at line 154 is imported at line 20 and has a Long-Range dependency. Variable 'successes' used at line 154 is defined at line 151 and has a Short-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
156
157
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' mask_no_success = tf.math.equal(terminate_idxes, 0)', ' terminate_idxes += tf.multiply((T - 1) * tf.ones_like(terminate_idxes),']
[' tf.cast(mask_no_success, terminate_idxes.dtype))', ' ', " # Get episode idx for each transition to sample: more likely to sample from episodes which didn't end in success", ' p = (terminate_idxes + 1) / tf.reduce_sum(terminate_idxes + 1)', ' episode_i...
[]
Library 'tf' used at line 156 is imported at line 20 and has a Long-Range dependency. Variable 'terminate_idxes' used at line 156 is defined at line 154 and has a Short-Range dependency. Variable 'terminate_idxes' used at line 157 is defined at line 154 and has a Short-Range dependency. Library 'tf' used at line 157 is...
{}
{'Library Long-Range': 2, 'Variable Short-Range': 3}
infilling_python
RL_Motion_Planning
161
163
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' p = (terminate_idxes + 1) / tf.reduce_sum(terminate_idxes + 1)', ' episode_idxs = tfp.distributions.Categorical(probs=p).sample(sample_shape=(batch_size,))', ' episode_idxs = tf.cast(episode_idxs, dtype=terminate_idxes.dtype)']
[' # Get terminate index for the selected episodes', ' terminate_idxes = tf.gather(terminate_idxes, episode_idxs)', ' print("terminate_idxes: ", terminate_idxes)', ' ', ' # ------------------------------------------------------------------------------------------------------------', '...
[]
Variable 'terminate_idxes' used at line 161 is defined at line 157 and has a Short-Range dependency. Library 'tf' used at line 161 is imported at line 20 and has a Long-Range dependency. Library 'tfp' used at line 162 is imported at line 21 and has a Long-Range dependency. Variable 'p' used at line 162 is defined at li...
{}
{'Variable Short-Range': 4, 'Library Long-Range': 3, 'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
162
163
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' episode_idxs = tfp.distributions.Categorical(probs=p).sample(sample_shape=(batch_size,))', ' episode_idxs = tf.cast(episode_idxs, dtype=terminate_idxes.dtype)']
[' # Get terminate index for the selected episodes', ' terminate_idxes = tf.gather(terminate_idxes, episode_idxs)', ' print("terminate_idxes: ", terminate_idxes)', ' ', ' # ------------------------------------------------------------------------------------------------------------', '...
[]
Library 'tfp' used at line 162 is imported at line 21 and has a Long-Range dependency. Variable 'p' used at line 162 is defined at line 161 and has a Short-Range dependency. Variable 'batch_size' used at line 162 is defined at line 149 and has a Medium-Range dependency. Library 'tf' used at line 163 is imported at line...
{}
{'Library Long-Range': 2, 'Variable Short-Range': 3, 'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
165
165
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' terminate_idxes = tf.gather(terminate_idxes, episode_idxs)']
[' print("terminate_idxes: ", terminate_idxes)', ' ', ' # ------------------------------------------------------------------------------------------------------------', ' # --------------------------------- 2) Select which time steps + goals to use --------------------------------', ' ...
[]
Library 'tf' used at line 165 is imported at line 20 and has a Long-Range dependency. Variable 'episode_idxs' used at line 165 is defined at line 163 and has a Short-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
171
173
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' t_samples_frac = tf.experimental.numpy.random.random(size=(batch_size,))', ' t_samples = t_samples_frac * tf.cast(terminate_idxes, dtype=t_samples_frac.dtype)', ' t_samples = tf.cast(tf.round(t_samples), dtype=terminate_idxes.dtype)']
[' ', ' # Get random init time step (before t_samples)', ' rdm_past_offset_frac = tf.zeros_like(t_samples_frac)', ' t_samples_init = rdm_past_offset_frac * tf.cast(t_samples, dtype=rdm_past_offset_frac.dtype)', ' t_samples_init = tf.cast(tf.floor(t_samples_init), dtype=t_samples.dtype...
[]
Library 'tf' used at line 171 is imported at line 20 and has a Long-Range dependency. Variable 'batch_size' used at line 171 is defined at line 149 and has a Medium-Range dependency. Variable 't_samples_frac' used at line 172 is defined at line 171 and has a Short-Range dependency. Library 'tf' used at line 172 is impo...
{}
{'Library Long-Range': 3, 'Variable Medium-Range': 1, 'Variable Short-Range': 3}
infilling_python
RL_Motion_Planning
176
178
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' rdm_past_offset_frac = tf.zeros_like(t_samples_frac)', ' t_samples_init = rdm_past_offset_frac * tf.cast(t_samples, dtype=rdm_past_offset_frac.dtype)', ' t_samples_init = tf.cast(tf.floor(t_samples_init), dtype=t_samples.dtype)']
[' print("t_samples_init: ", t_samples_init)', ' ', ' # Get the future time step', ' rdm_future_offset_frac = tf.experimental.numpy.random.random(size=(batch_size,))', ' future_offset = rdm_future_offset_frac * tf.cast((terminate_idxes - t_samples), rdm_future_offset_frac.dtype)', ' ...
[]
Library 'tf' used at line 176 is imported at line 20 and has a Long-Range dependency. Variable 't_samples_frac' used at line 176 is defined at line 171 and has a Short-Range dependency. Variable 'rdm_past_offset_frac' used at line 177 is defined at line 176 and has a Short-Range dependency. Library 'tf' used at line 17...
{}
{'Library Long-Range': 3, 'Variable Short-Range': 4}
infilling_python
RL_Motion_Planning
177
178
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' t_samples_init = rdm_past_offset_frac * tf.cast(t_samples, dtype=rdm_past_offset_frac.dtype)', ' t_samples_init = tf.cast(tf.floor(t_samples_init), dtype=t_samples.dtype)']
[' print("t_samples_init: ", t_samples_init)', ' ', ' # Get the future time step', ' rdm_future_offset_frac = tf.experimental.numpy.random.random(size=(batch_size,))', ' future_offset = rdm_future_offset_frac * tf.cast((terminate_idxes - t_samples), rdm_future_offset_frac.dtype)', ' ...
[]
Variable 'rdm_past_offset_frac' used at line 177 is defined at line 176 and has a Short-Range dependency. Library 'tf' used at line 177 is imported at line 20 and has a Long-Range dependency. Variable 't_samples' used at line 177 is defined at line 173 and has a Short-Range dependency. Library 'tf' used at line 178 is ...
{}
{'Variable Short-Range': 3, 'Library Long-Range': 2}
infilling_python
RL_Motion_Planning
182
184
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' rdm_future_offset_frac = tf.experimental.numpy.random.random(size=(batch_size,))', ' future_offset = rdm_future_offset_frac * tf.cast((terminate_idxes - t_samples), rdm_future_offset_frac.dtype)', ' future_offset = tf.cast(future_offset, terminate_idxes.dtype)']
[' t_samples_future = t_samples + future_offset', ' print("t_samples_future: ", t_samples_future)', ' ', ' # ------------------------------------------------------------------------------------------------------------', ' # ----------------- 3) Select the batch of transitions correspo...
[]
Library 'tf' used at line 182 is imported at line 20 and has a Long-Range dependency. Variable 'batch_size' used at line 182 is defined at line 149 and has a Long-Range dependency. Variable 'rdm_future_offset_frac' used at line 183 is defined at line 182 and has a Short-Range dependency. Library 'tf' used at line 183 i...
{}
{'Library Long-Range': 3, 'Variable Long-Range': 1, 'Variable Short-Range': 3, 'Variable Medium-Range': 2}
infilling_python
RL_Motion_Planning
182
185
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' rdm_future_offset_frac = tf.experimental.numpy.random.random(size=(batch_size,))', ' future_offset = rdm_future_offset_frac * tf.cast((terminate_idxes - t_samples), rdm_future_offset_frac.dtype)', ' future_offset = tf.cast(future_offset, terminate_idxes.dtype)', ' t_samples_future = t_sam...
[' print("t_samples_future: ", t_samples_future)', ' ', ' # ------------------------------------------------------------------------------------------------------------', ' # ----------------- 3) Select the batch of transitions corresponding to the current time steps ---------------', ' ...
[]
Library 'tf' used at line 182 is imported at line 20 and has a Long-Range dependency. Variable 'batch_size' used at line 182 is defined at line 149 and has a Long-Range dependency. Variable 'rdm_future_offset_frac' used at line 183 is defined at line 182 and has a Short-Range dependency. Library 'tf' used at line 183 i...
{}
{'Library Long-Range': 3, 'Variable Long-Range': 1, 'Variable Short-Range': 4, 'Variable Medium-Range': 3}
infilling_python
RL_Motion_Planning
190
193
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' curr_indices = tf.stack((episode_idxs, t_samples), axis=-1)', ' transitions = {}', ' for key in episodic_data.keys():', ' transitions[key] = tf.gather_nd(episodic_data[key], indices=curr_indices)']
[' ', " transitions['achieved_goals'] = state_to_goal(", " states=tf.gather_nd(episodic_data['states'], indices=curr_indices),", ' obj_identifiers=None)', ' ', ' # --------------- 4) Select the batch of transitions corresponding to the future time steps ------------', '...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 192}, {'reason_category': 'Loop Body', 'usage_line': 193}]
Library 'tf' used at line 190 is imported at line 20 and has a Long-Range dependency. Variable 'episode_idxs' used at line 190 is defined at line 163 and has a Medium-Range dependency. Variable 't_samples' used at line 190 is defined at line 173 and has a Medium-Range dependency. Variable 'episodic_data' used at line 1...
{'Define Stop Criteria': 1, 'Loop Body': 1}
{'Library Long-Range': 2, 'Variable Medium-Range': 2, 'Variable Long-Range': 2, 'Variable Short-Range': 2, 'Variable Loop Short-Range': 1}
infilling_python
RL_Motion_Planning
192
193
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' for key in episodic_data.keys():', ' transitions[key] = tf.gather_nd(episodic_data[key], indices=curr_indices)']
[' ', " transitions['achieved_goals'] = state_to_goal(", " states=tf.gather_nd(episodic_data['states'], indices=curr_indices),", ' obj_identifiers=None)', ' ', ' # --------------- 4) Select the batch of transitions corresponding to the future time steps ------------', '...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 192}, {'reason_category': 'Loop Body', 'usage_line': 193}]
Variable 'episodic_data' used at line 192 is defined at line 143 and has a Long-Range dependency. Variable 'transitions' used at line 193 is defined at line 191 and has a Short-Range dependency. Variable 'key' used at line 193 is part of a Loop defined at line 192 and has a Short-Range dependency. Library 'tf' used at ...
{'Define Stop Criteria': 1, 'Loop Body': 1}
{'Variable Long-Range': 2, 'Variable Short-Range': 2, 'Variable Loop Short-Range': 1, 'Library Long-Range': 1}
infilling_python
RL_Motion_Planning
196
197
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[" states=tf.gather_nd(episodic_data['states'], indices=curr_indices),", ' obj_identifiers=None)']
[' ', ' # --------------- 4) Select the batch of transitions corresponding to the future time steps ------------', ' future_indices = tf.stack((episode_idxs, t_samples_future), axis=-1)', " transitions['her_goals'] = state_to_goal(states=tf.gather_nd(episodic_data['states'], indices=future_i...
[]
Library 'tf' used at line 196 is imported at line 20 and has a Long-Range dependency. Variable 'episodic_data' used at line 196 is defined at line 143 and has a Long-Range dependency. Variable 'curr_indices' used at line 196 is defined at line 190 and has a Short-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
200
200
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' future_indices = tf.stack((episode_idxs, t_samples_future), axis=-1)']
[" transitions['her_goals'] = state_to_goal(states=tf.gather_nd(episodic_data['states'], indices=future_indices),", ' obj_identifiers=None) # Object ids are not used for unsegmented HER', ' ', ' # --------------- 5) Select the batch of transitions co...
[]
Library 'tf' used at line 200 is imported at line 20 and has a Long-Range dependency. Variable 'episode_idxs' used at line 200 is defined at line 163 and has a Long-Range dependency. Variable 't_samples_future' used at line 200 is defined at line 185 and has a Medium-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Long-Range': 1, 'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
201
202
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[" transitions['her_goals'] = state_to_goal(states=tf.gather_nd(episodic_data['states'], indices=future_indices),", ' obj_identifiers=None) # Object ids are not used for unsegmented HER']
[' ', ' # --------------- 5) Select the batch of transitions corresponding to the initial time steps ------------', ' init_indices = tf.stack((episode_idxs, t_samples_init), axis=-1)', " transitions['init_states'] = tf.gather_nd(episodic_data['states'], indices=init_indices)", ' print...
[]
Variable 'transitions' used at line 201 is defined at line 195 and has a Short-Range dependency. Variable 'state_to_goal' used at line 201 is defined at line 142 and has a Long-Range dependency. Library 'tf' used at line 201 is imported at line 20 and has a Long-Range dependency. Variable 'episodic_data' used at line 2...
{}
{'Variable Short-Range': 2, 'Variable Long-Range': 2, 'Library Long-Range': 1}
infilling_python
RL_Motion_Planning
205
205
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' init_indices = tf.stack((episode_idxs, t_samples_init), axis=-1)']
[" transitions['init_states'] = tf.gather_nd(episodic_data['states'], indices=init_indices)", ' print("transitions: ", transitions)', ' return transitions', ' ', " if sample_style == 'random_unsegmented':", ' return sample_random_transitions', ' else:', ' raise NotImplemented...
[]
Library 'tf' used at line 205 is imported at line 20 and has a Long-Range dependency. Variable 'episode_idxs' used at line 205 is defined at line 163 and has a Long-Range dependency. Variable 't_samples_init' used at line 205 is defined at line 178 and has a Medium-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Long-Range': 1, 'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
206
206
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[" transitions['init_states'] = tf.gather_nd(episodic_data['states'], indices=init_indices)"]
[' print("transitions: ", transitions)', ' return transitions', ' ', " if sample_style == 'random_unsegmented':", ' return sample_random_transitions', ' else:', ' raise NotImplementedError', '', '', 'class ReplayBufferTf:', ' def __init__(self, buffer_shapes: Dict[str, Tuple[int,...
[]
Variable 'transitions' used at line 206 is defined at line 201 and has a Short-Range dependency. Library 'tf' used at line 206 is imported at line 20 and has a Long-Range dependency. Variable 'episodic_data' used at line 206 is defined at line 143 and has a Long-Range dependency. Variable 'init_indices' used at line 20...
{}
{'Variable Short-Range': 2, 'Library Long-Range': 1, 'Variable Long-Range': 1}
infilling_python
RL_Motion_Planning
211
211
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' return sample_random_transitions']
[' else:', ' raise NotImplementedError', '', '', 'class ReplayBufferTf:', ' def __init__(self, buffer_shapes: Dict[str, Tuple[int, ...]], size_in_transitions, T, transition_fn=None):', ' """Creates a replay buffer.', '', ' Args:', ' buffer_shapes (dict of ints): the shape for all b...
[{'reason_category': 'If Body', 'usage_line': 211}]
Function 'sample_random_transitions' used at line 211 is defined at line 143 and has a Long-Range dependency.
{'If Body': 1}
{'Function Long-Range': 1}
infilling_python
RL_Motion_Planning
243
244
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' for index, key in enumerate(self.buffer_keys):', ' buffered_data[key] = _data[index]']
[' ', ' transitions = self.transition_fn(buffered_data, batch_size)', ' print("transitions: ", transitions)', ' return transitions', ' ', ' @tf.function', ' def sample_episodes(self, ep_start: int = None, ep_end: int = None, num_episodes: int = None):', ' ', ' if ep_st...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 243}, {'reason_category': 'Loop Body', 'usage_line': 244}]
Variable 'self' used at line 243 is defined at line 239 and has a Short-Range dependency. Variable 'buffered_data' used at line 244 is defined at line 241 and has a Short-Range dependency. Variable 'key' used at line 244 is part of a Loop defined at line 243 and has a Short-Range dependency. Variable '_data' used at li...
{'Define Stop Criteria': 1, 'Loop Body': 1}
{'Variable Short-Range': 3, 'Variable Loop Short-Range': 2}
infilling_python
RL_Motion_Planning
246
246
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' transitions = self.transition_fn(buffered_data, batch_size)']
[' print("transitions: ", transitions)', ' return transitions', ' ', ' @tf.function', ' def sample_episodes(self, ep_start: int = None, ep_end: int = None, num_episodes: int = None):', ' ', ' if ep_start is None or ep_end is None:', ' if num_episodes:', ' n...
[]
Variable 'self' used at line 246 is defined at line 239 and has a Short-Range dependency. Variable 'buffered_data' used at line 246 is defined at line 241 and has a Short-Range dependency. Variable 'batch_size' used at line 246 is defined at line 239 and has a Short-Range dependency.
{}
{'Variable Short-Range': 3}
infilling_python
RL_Motion_Planning
255
255
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' num_episodes = tf.math.minimum(tf.cast(num_episodes, dtype=self.current_size.dtype), self.current_size)']
[' else:', ' num_episodes = self.current_size', ' ep_range = tf.range(num_episodes)', ' else:', ' ep_range = tf.range(ep_start, ep_end)', ' ', ' buffered_data = {}', ' _data = self.table.read(rows=ep_range)', ' for index, key in enumerat...
[{'reason_category': 'If Body', 'usage_line': 255}]
Library 'tf' used at line 255 is imported at line 20 and has a Long-Range dependency. Variable 'self' used at line 255 is defined at line 251 and has a Short-Range dependency.
{'If Body': 1}
{'Library Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
257
257
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' num_episodes = self.current_size']
[' ep_range = tf.range(num_episodes)', ' else:', ' ep_range = tf.range(ep_start, ep_end)', ' ', ' buffered_data = {}', ' _data = self.table.read(rows=ep_range)', ' for index, key in enumerate(self.buffer_keys):', ' buffered_data[key] = _data[index]', '...
[{'reason_category': 'If Body', 'usage_line': 257}, {'reason_category': 'Else Reasoning', 'usage_line': 257}]
Variable 'self' used at line 257 is defined at line 251 and has a Short-Range dependency.
{'If Body': 1, 'Else Reasoning': 1}
{'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
258
258
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' ep_range = tf.range(num_episodes)']
[' else:', ' ep_range = tf.range(ep_start, ep_end)', ' ', ' buffered_data = {}', ' _data = self.table.read(rows=ep_range)', ' for index, key in enumerate(self.buffer_keys):', ' buffered_data[key] = _data[index]', ' print("buffered_data: ", buffered_data)',...
[{'reason_category': 'If Body', 'usage_line': 258}]
Library 'tf' used at line 258 is imported at line 20 and has a Long-Range dependency. Variable 'num_episodes' used at line 258 is defined at line 257 and has a Short-Range dependency.
{'If Body': 1}
{'Library Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
260
260
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' ep_range = tf.range(ep_start, ep_end)']
[' ', ' buffered_data = {}', ' _data = self.table.read(rows=ep_range)', ' for index, key in enumerate(self.buffer_keys):', ' buffered_data[key] = _data[index]', ' print("buffered_data: ", buffered_data)', ' return buffered_data', ' ', ' @tf.function', ' def ...
[{'reason_category': 'Else Reasoning', 'usage_line': 260}]
Library 'tf' used at line 260 is imported at line 20 and has a Long-Range dependency. Variable 'ep_start' used at line 260 is defined at line 251 and has a Short-Range dependency. Variable 'ep_end' used at line 260 is defined at line 251 and has a Short-Range dependency.
{'Else Reasoning': 1}
{'Library Long-Range': 1, 'Variable Short-Range': 2}
infilling_python
RL_Motion_Planning
264
265
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' for index, key in enumerate(self.buffer_keys):', ' buffered_data[key] = _data[index]']
[' print("buffered_data: ", buffered_data)', ' return buffered_data', ' ', ' @tf.function', ' def store_episode(self, episode_batch):', ' """', ' Store each episode into replay buffer', ' episode_batch: {"": array(1 x (T or T+1) x dim)}', ' """', ' idxs ...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 264}, {'reason_category': 'Loop Body', 'usage_line': 265}]
Variable 'self' used at line 264 is defined at line 251 and has a Medium-Range dependency. Variable 'buffered_data' used at line 265 is defined at line 262 and has a Short-Range dependency. Variable 'key' used at line 265 is part of a Loop defined at line 264 and has a Short-Range dependency. Variable '_data' used at l...
{'Define Stop Criteria': 1, 'Loop Body': 1}
{'Variable Medium-Range': 1, 'Variable Short-Range': 2, 'Variable Loop Short-Range': 2}
infilling_python
RL_Motion_Planning
278
278
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' self.n_transitions_stored.assign(self.n_transitions_stored + self.T)']
[' ', ' def store_episodes(self, episodes_batch):', " for ep_idx in tf.range(tf.shape(episodes_batch['actions'])[0]):", ' episode_batch = {}', ' for key in self.buffer_keys:', ' episode_batch[key] = tf.gather(episodes_batch[key], ep_idx)', ' self.store_episod...
[]
Variable 'self' used at line 278 is defined at line 270 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
283
285
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' for key in self.buffer_keys:', ' episode_batch[key] = tf.gather(episodes_batch[key], ep_idx)', ' self.store_episode(episode_batch)']
[' ', ' def _get_storage_idxs(self, num_to_ins=None):', ' if num_to_ins is None:', ' num_to_ins = tf.cast(1, dtype=tf.int32)', ' ', ' # consecutively insert until you hit the end of the buffer, and then insert randomly.', ' if self.current_size + num_to_ins <= self.buffer_si...
[{'reason_category': 'Loop Body', 'usage_line': 283}, {'reason_category': 'Define Stop Criteria', 'usage_line': 283}, {'reason_category': 'Loop Body', 'usage_line': 284}, {'reason_category': 'Loop Body', 'usage_line': 285}]
Variable 'self' used at line 283 is defined at line 280 and has a Short-Range dependency. Variable 'episode_batch' used at line 284 is defined at line 282 and has a Short-Range dependency. Variable 'key' used at line 284 is part of a Loop defined at line 283 and has a Short-Range dependency. Library 'tf' used at line 2...
{'Loop Body': 3, 'Define Stop Criteria': 1}
{'Variable Short-Range': 5, 'Variable Loop Short-Range': 2, 'Library Long-Range': 1}
infilling_python
RL_Motion_Planning
293
293
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' idxs = tf.range(self.current_size, self.current_size + num_to_ins)']
[' elif self.current_size < self.buffer_size:', ' overflow = num_to_ins - (self.buffer_size - self.current_size)', ' idx_a = tf.range(self.current_size, self.buffer_size)', ' idx_b = tf.experimental.numpy.random.randint(0, self.current_size, size=(overflow,), dtype=tf.int32)', ' ...
[{'reason_category': 'If Body', 'usage_line': 293}]
Library 'tf' used at line 293 is imported at line 20 and has a Long-Range dependency. Variable 'self' used at line 293 is defined at line 287 and has a Short-Range dependency. Variable 'num_to_ins' used at line 293 is defined at line 287 and has a Short-Range dependency.
{'If Body': 1}
{'Library Long-Range': 1, 'Variable Short-Range': 2}
infilling_python
RL_Motion_Planning
295
298
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' overflow = num_to_ins - (self.buffer_size - self.current_size)', ' idx_a = tf.range(self.current_size, self.buffer_size)', ' idx_b = tf.experimental.numpy.random.randint(0, self.current_size, size=(overflow,), dtype=tf.int32)', ' idxs = tf.concat([idx_a, idx_b], axis=0)']
[' else:', ' idxs = tf.experimental.numpy.random.randint(0, self.buffer_size, size=(num_to_ins,), dtype=tf.int32)', ' ', ' # update buffer size', ' self.current_size.assign(tf.math.minimum(self.buffer_size, self.current_size + num_to_ins))', ' print("idxs: ", idxs)', ' ...
[{'reason_category': 'Elif Body', 'usage_line': 295}, {'reason_category': 'Elif Body', 'usage_line': 296}, {'reason_category': 'Elif Body', 'usage_line': 297}, {'reason_category': 'Elif Body', 'usage_line': 298}]
Variable 'num_to_ins' used at line 295 is defined at line 287 and has a Short-Range dependency. Variable 'self' used at line 295 is defined at line 287 and has a Short-Range dependency. Library 'tf' used at line 296 is imported at line 20 and has a Long-Range dependency. Variable 'self' used at line 296 is defined at l...
{'Elif Body': 4}
{'Variable Short-Range': 7, 'Library Long-Range': 3}
infilling_python
RL_Motion_Planning
300
300
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' idxs = tf.experimental.numpy.random.randint(0, self.buffer_size, size=(num_to_ins,), dtype=tf.int32)']
[' ', ' # update buffer size', ' self.current_size.assign(tf.math.minimum(self.buffer_size, self.current_size + num_to_ins))', ' print("idxs: ", idxs)', ' return idxs', ' ', ' def get_current_size_ep(self):', ' return self.current_size', ' ', ' def get_current_size_...
[{'reason_category': 'Else Reasoning', 'usage_line': 300}]
Library 'tf' used at line 300 is imported at line 20 and has a Long-Range dependency. Variable 'self' used at line 300 is defined at line 287 and has a Medium-Range dependency. Variable 'num_to_ins' used at line 300 is defined at line 287 and has a Medium-Range dependency.
{'Else Reasoning': 1}
{'Library Long-Range': 1, 'Variable Medium-Range': 2}
infilling_python
RL_Motion_Planning
303
303
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' self.current_size.assign(tf.math.minimum(self.buffer_size, self.current_size + num_to_ins))']
[' print("idxs: ", idxs)', ' return idxs', ' ', ' def get_current_size_ep(self):', ' return self.current_size', ' ', ' def get_current_size_trans(self):', ' return self.current_size * self.T', ' ', ' def clear_buffer(self):', ' self.current_size.assign(0)', ' ', '...
[]
Variable 'self' used at line 303 is defined at line 287 and has a Medium-Range dependency. Library 'tf' used at line 303 is imported at line 20 and has a Long-Range dependency. Variable 'num_to_ins' used at line 303 is defined at line 287 and has a Medium-Range dependency.
{}
{'Variable Medium-Range': 2, 'Library Long-Range': 1}
infilling_python
RL_Motion_Planning
308
308
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' return self.current_size']
[' ', ' def get_current_size_trans(self):', ' return self.current_size * self.T', ' ', ' def clear_buffer(self):', ' self.current_size.assign(0)', ' ', ' @property', ' def full(self):', ' return self.current_size == self.buffer_size', ' ', ' def __len__(self):', ' ...
[]
Variable 'self' used at line 308 is defined at line 307 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
311
311
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' return self.current_size * self.T']
[' ', ' def clear_buffer(self):', ' self.current_size.assign(0)', ' ', ' @property', ' def full(self):', ' return self.current_size == self.buffer_size', ' ', ' def __len__(self):', ' return self.current_size', ' ', ' def save_buffer_data(self, path):', ' buffered_...
[]
Variable 'self' used at line 311 is defined at line 310 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
314
314
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' self.current_size.assign(0)']
[' ', ' @property', ' def full(self):', ' return self.current_size == self.buffer_size', ' ', ' def __len__(self):', ' return self.current_size', ' ', ' def save_buffer_data(self, path):', ' buffered_data = {}', ' _data = self.table.read(rows=tf.range(self.current_size))...
[]
Variable 'self' used at line 314 is defined at line 313 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
318
318
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' return self.current_size == self.buffer_size']
[' ', ' def __len__(self):', ' return self.current_size', ' ', ' def save_buffer_data(self, path):', ' buffered_data = {}', ' _data = self.table.read(rows=tf.range(self.current_size))', ' for index, key in enumerate(self.buffer_keys):', ' buffered_data[key] = _data[ind...
[]
Variable 'self' used at line 318 is defined at line 317 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
321
321
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' return self.current_size']
[' ', ' def save_buffer_data(self, path):', ' buffered_data = {}', ' _data = self.table.read(rows=tf.range(self.current_size))', ' for index, key in enumerate(self.buffer_keys):', ' buffered_data[key] = _data[index]', ' ', " with open(path, 'wb') as handle:", ' ...
[]
Variable 'self' used at line 321 is defined at line 320 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
325
327
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' _data = self.table.read(rows=tf.range(self.current_size))', ' for index, key in enumerate(self.buffer_keys):', ' buffered_data[key] = _data[index]']
[' ', " with open(path, 'wb') as handle:", ' pickle.dump(buffered_data, handle, protocol=pickle.HIGHEST_PROTOCOL)', ' ', ' def load_data_into_buffer(self, buffered_data=None, clear_buffer=True, num_demos_to_load=None):', ' ', ' if buffered_data is None:', ' raise ...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 326}, {'reason_category': 'Loop Body', 'usage_line': 327}]
Variable 'self' used at line 325 is defined at line 323 and has a Short-Range dependency. Library 'tf' used at line 325 is imported at line 20 and has a Long-Range dependency. Variable 'self' used at line 326 is defined at line 323 and has a Short-Range dependency. Variable 'buffered_data' used at line 327 is defined a...
{'Define Stop Criteria': 1, 'Loop Body': 1}
{'Variable Short-Range': 4, 'Library Long-Range': 1, 'Variable Loop Short-Range': 2}
infilling_python
RL_Motion_Planning
338
338
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' self.clear_buffer()']
[' ', ' if num_demos_to_load is not None:', ' ', ' # Randomly sample idxs to load', " idxs = np.random.choice(len(buffered_data['actions']), size=num_demos_to_load, replace=False).tolist()", ' ', ' for key in buffered_data.keys():', ' b...
[{'reason_category': 'If Body', 'usage_line': 338}]
Variable 'self' used at line 338 is defined at line 332 and has a Short-Range dependency.
{'If Body': 1}
{'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
343
343
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[" idxs = np.random.choice(len(buffered_data['actions']), size=num_demos_to_load, replace=False).tolist()"]
[' ', ' for key in buffered_data.keys():', ' buffered_data[key] = tf.gather(buffered_data[key], idxs)', ' ', ' # Check if all tensors are present in loaded data', ' data_sizes = [len(buffered_data[key]) for key in self.buffer_keys]', ' assert np.all(np.ar...
[{'reason_category': 'If Body', 'usage_line': 343}]
Library 'np' used at line 343 is imported at line 19 and has a Long-Range dependency. Variable 'buffered_data' used at line 343 is defined at line 332 and has a Medium-Range dependency. Variable 'num_demos_to_load' used at line 343 is defined at line 332 and has a Medium-Range dependency.
{'If Body': 1}
{'Library Long-Range': 1, 'Variable Medium-Range': 2}
infilling_python
RL_Motion_Planning
349
350
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' data_sizes = [len(buffered_data[key]) for key in self.buffer_keys]', ' assert np.all(np.array(data_sizes) == data_sizes[0])']
[' ', ' idxs = self._get_storage_idxs(num_to_ins=data_sizes[0])', ' values = [buffered_data[key] for key in self.buffer_keys]', ' ', ' self.table.write(rows=idxs, values=values)', ' self.n_transitions_stored.assign(self.n_transitions_stored + len(idxs) * self.T)', '', '', 'clas...
[{'reason_category': 'List_Comprehension', 'usage_line': 349}]
Variable 'key' used at line 349 is part of a List_Comprehension defined at line 349 and has a Short-Range dependency. Variable 'self' used at line 349 is defined at line 332 and has a Medium-Range dependency. Variable 'buffered_data' used at line 349 is defined at line 332 and has a Medium-Range dependency. Library 'np...
{'List_Comprehension': 1}
{'Variable List_Comprehension Short-Range': 1, 'Variable Medium-Range': 2, 'Library Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
355
356
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' self.table.write(rows=idxs, values=values)', ' self.n_transitions_stored.assign(self.n_transitions_stored + len(idxs) * self.T)']
['', '', 'class Actor(tf.keras.Model):', ' def __init__(self, action_dim):', ' super(Actor, self).__init__()', ' ', ' # Rewrite the base weights to initialise using Xavier(gain=1.0) and bias=0.0', ' self.base = tf.keras.Sequential([', " Dense(units=256, activation=tf.nn.relu, k...
[]
Variable 'self' used at line 355 is defined at line 332 and has a Medium-Range dependency. Variable 'idxs' used at line 355 is defined at line 352 and has a Short-Range dependency. Variable 'values' used at line 355 is defined at line 353 and has a Short-Range dependency. Variable 'self' used at line 356 is defined at ...
{}
{'Variable Medium-Range': 2, 'Variable Short-Range': 3}
infilling_python
RL_Motion_Planning
386
396
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' mu = self.base(states)', ' mu = tf.nn.tanh(mu)', ' mu = tf.clip_by_value(mu, self.MEAN_MIN, self.MEAN_MAX)', ' ', ' std = tf.ones_like(mu) * self.FIXED_STD', ' ', ' actions = tf.clip_by_value(actions, -1 + self.eps, 1 - self.eps)', ' ', ' # Get log probs...
[' print("log_probs: ", log_probs)', ' return log_probs', ' ', ' def call(self, states, training=None, mask=None):', ' """Computes actions for given inputs.', ' Args:', ' states: A batch of states.', ' training: Ignored', ' mask: Ignored.', ' Returns:'...
[]
Variable 'self' used at line 386 is defined at line 378 and has a Short-Range dependency. Variable 'states' used at line 386 is defined at line 378 and has a Short-Range dependency. Library 'tf' used at line 387 is imported at line 20 and has a Long-Range dependency. Variable 'mu' used at line 387 is defined at line 38...
{}
{'Variable Short-Range': 9, 'Library Long-Range': 6, 'Variable Medium-Range': 4}
infilling_python
RL_Motion_Planning
392
392
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' actions = tf.clip_by_value(actions, -1 + self.eps, 1 - self.eps)']
[' ', ' # Get log probs from Gaussian distribution', ' log_probs = -0.5 * tf.square((actions - mu) / std) - 0.5 * tf.math.log(2 * self.pi) - tf.math.log(std)', ' log_probs = tf.reduce_sum(log_probs, axis=1, keepdims=False)', ' print("log_probs: ", log_probs)', ' return log_prob...
[]
Library 'tf' used at line 392 is imported at line 20 and has a Long-Range dependency. Variable 'self' used at line 392 is defined at line 378 and has a Medium-Range dependency. Variable 'actions' used at line 392 is defined at line 378 and has a Medium-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Medium-Range': 2}
infilling_python
RL_Motion_Planning
395
396
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' log_probs = -0.5 * tf.square((actions - mu) / std) - 0.5 * tf.math.log(2 * self.pi) - tf.math.log(std)', ' log_probs = tf.reduce_sum(log_probs, axis=1, keepdims=False)']
[' print("log_probs: ", log_probs)', ' return log_probs', ' ', ' def call(self, states, training=None, mask=None):', ' """Computes actions for given inputs.', ' Args:', ' states: A batch of states.', ' training: Ignored', ' mask: Ignored.', ' Returns:'...
[]
Library 'tf' used at line 395 is imported at line 20 and has a Long-Range dependency. Variable 'actions' used at line 395 is defined at line 392 and has a Short-Range dependency. Variable 'mu' used at line 395 is defined at line 388 and has a Short-Range dependency. Variable 'std' used at line 395 is defined at line 39...
{}
{'Library Long-Range': 2, 'Variable Short-Range': 3, 'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
410
411
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' mu = tf.nn.tanh(mu)', ' mu = tf.clip_by_value(mu, self.MEAN_MIN, self.MEAN_MAX)']
[' ', ' if self.train:', ' # Sample actions from the distribution', ' actions = tf.random.normal(shape=mu.shape, mean=mu, stddev=self.FIXED_STD)', ' else:', ' actions = mu', ' ', ' # Compute log probs', ' log_probs = self.get_log_prob(states, ac...
[]
Library 'tf' used at line 410 is imported at line 20 and has a Long-Range dependency. Variable 'mu' used at line 410 is defined at line 409 and has a Short-Range dependency. Library 'tf' used at line 411 is imported at line 20 and has a Long-Range dependency. Variable 'self' used at line 411 is defined at line 400 and ...
{}
{'Library Long-Range': 2, 'Variable Short-Range': 2, 'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
415
415
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' actions = tf.random.normal(shape=mu.shape, mean=mu, stddev=self.FIXED_STD)']
[' else:', ' actions = mu', ' ', ' # Compute log probs', ' log_probs = self.get_log_prob(states, actions)', ' log_probs = tf.expand_dims(log_probs, -1) # To avoid broadcasting', ' ', ' actions = tf.clip_by_value(actions, -1 + self.eps, 1 - self.eps)', ' ...
[{'reason_category': 'If Body', 'usage_line': 415}]
Library 'tf' used at line 415 is imported at line 20 and has a Long-Range dependency. Variable 'mu' used at line 415 is defined at line 411 and has a Short-Range dependency. Variable 'self' used at line 415 is defined at line 400 and has a Medium-Range dependency.
{'If Body': 1}
{'Library Long-Range': 1, 'Variable Short-Range': 1, 'Variable Medium-Range': 1}
infilling_python
RL_Motion_Planning
420
420
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' log_probs = self.get_log_prob(states, actions)']
[' log_probs = tf.expand_dims(log_probs, -1) # To avoid broadcasting', ' ', ' actions = tf.clip_by_value(actions, -1 + self.eps, 1 - self.eps)', ' print("mu: ", mu)', ' print("actions: ", actions)', ' print("log_probs: ", log_probs)', ' return mu, actions, log_probs', '...
[]
Variable 'self' used at line 420 is defined at line 400 and has a Medium-Range dependency. Variable 'states' used at line 420 is defined at line 400 and has a Medium-Range dependency. Variable 'actions' used at line 420 is defined at line 417 and has a Short-Range dependency.
{}
{'Variable Medium-Range': 2, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
423
423
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' actions = tf.clip_by_value(actions, -1 + self.eps, 1 - self.eps)']
[' print("mu: ", mu)', ' print("actions: ", actions)', ' print("log_probs: ", log_probs)', ' return mu, actions, log_probs', '', '', 'class BC(tf.keras.Model, ABC):', ' def __init__(self, args: Namespace):', ' super(BC, self).__init__()', ' self.args = args', ' ', ' ...
[]
Library 'tf' used at line 423 is imported at line 20 and has a Long-Range dependency. Variable 'self' used at line 423 is defined at line 400 and has a Medium-Range dependency. Variable 'actions' used at line 423 is defined at line 417 and has a Short-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Medium-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
452
453
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[" pi_loss = tf.reduce_sum(tf.math.squared_difference(data_rb['actions'], actions_mu), axis=-1)", ' pi_loss = tf.reduce_mean(pi_loss)']
[' penalty = orthogonal_regularization(self.actor.base)', ' pi_loss_w_penalty = pi_loss + penalty', ' ', ' grads = tape.gradient(pi_loss_w_penalty, self.actor.trainable_variables)', ' self.actor_optimizer.apply_gradients(zip(grads, self.actor.trainable_variables))', ' p...
[]
Library 'tf' used at line 452 is imported at line 20 and has a Long-Range dependency. Variable 'data_rb' used at line 452 is defined at line 447 and has a Short-Range dependency. Variable 'actions_mu' used at line 452 is defined at line 451 and has a Short-Range dependency. Library 'tf' used at line 453 is imported at ...
{}
{'Library Long-Range': 2, 'Variable Short-Range': 3}
infilling_python
RL_Motion_Planning
454
454
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' penalty = orthogonal_regularization(self.actor.base)']
[' pi_loss_w_penalty = pi_loss + penalty', ' ', ' grads = tape.gradient(pi_loss_w_penalty, self.actor.trainable_variables)', ' self.actor_optimizer.apply_gradients(zip(grads, self.actor.trainable_variables))', ' print("loss/pi: ", pi_loss)', ' print("penalty/pi_ortho_penalt...
[]
Function 'orthogonal_regularization' used at line 454 is defined at line 122 and has a Long-Range dependency. Variable 'self' used at line 454 is defined at line 447 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
457
457
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' grads = tape.gradient(pi_loss_w_penalty, self.actor.trainable_variables)']
[' self.actor_optimizer.apply_gradients(zip(grads, self.actor.trainable_variables))', ' print("loss/pi: ", pi_loss)', ' print("penalty/pi_ortho_penalty: ", penalty)', ' return {', " 'loss/pi': pi_loss,", " 'penalty/pi_ortho_penalty': penalty,", ' }', ' ', ' ...
[]
Variable 'pi_loss_w_penalty' used at line 457 is defined at line 455 and has a Short-Range dependency. Variable 'self' used at line 457 is defined at line 447 and has a Short-Range dependency.
{}
{'Variable Short-Range': 2}
infilling_python
RL_Motion_Planning
501
501
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' skill = tf.zeros((1, self.args.c_dim))']
[' return skill', ' ', ' @staticmethod', ' def get_init_goal(init_state, g_env):', ' return g_env', ' ', ' def build_model(self):', ' # a_t <- f(s_t) for each skill', ' _ = self.actor(tf.concat([np.ones([1, self.args.s_dim]), np.ones([1, self.args.g_dim])], 1))', ' ', ' ...
[]
Library 'tf' used at line 501 is imported at line 20 and has a Long-Range dependency. Variable 'self' used at line 501 is defined at line 497 and has a Short-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Short-Range': 1}
infilling_python
RL_Motion_Planning
510
510
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' _ = self.actor(tf.concat([np.ones([1, self.args.s_dim]), np.ones([1, self.args.g_dim])], 1))']
[' ', ' def save_(self, dir_param):', ' self.actor.save_weights(dir_param + "/policy.h5")', ' ', ' def load_(self, dir_param):', ' self.actor.load_weights(dir_param + "/policy.h5")', ' ', ' def change_training_mode(self, training_mode: bool):', ' pass', ' ', ' def update_tar...
[]
Variable 'self' used at line 510 is defined at line 508 and has a Short-Range dependency. Library 'tf' used at line 510 is imported at line 20 and has a Long-Range dependency. Library 'np' used at line 510 is imported at line 19 and has a Long-Range dependency.
{}
{'Variable Short-Range': 1, 'Library Long-Range': 2}
infilling_python
RL_Motion_Planning
562
563
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' tf.keras.backend.clear_session()', ' tf.compat.v1.reset_default_graph()']
[' ', ' def preprocess_in_state_space(self, item):', ' item = tf.clip_by_value(item, -self.args.clip_obs, self.args.clip_obs)', ' return item', ' ', ' def save_model(self, dir_param):', ' if not os.path.exists(dir_param):', ' os.makedirs(dir_param)', ' self.model.save_...
[{'reason_category': 'If Body', 'usage_line': 562}, {'reason_category': 'If Body', 'usage_line': 563}]
Library 'tf' used at line 562 is imported at line 20 and has a Long-Range dependency. Library 'tf' used at line 563 is imported at line 20 and has a Long-Range dependency.
{'If Body': 2}
{'Library Long-Range': 2}
infilling_python
RL_Motion_Planning
566
566
['import os', "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging", "os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # Suppress oneDNN warning", '# os.environ["CUDA_VISIBLE_DEVICES"] = "0"', 'import argparse', 'import datetime', 'import json', 'import os', 'import pickle', 'import sys', 'import time', '...
[' item = tf.clip_by_value(item, -self.args.clip_obs, self.args.clip_obs)']
[' return item', ' ', ' def save_model(self, dir_param):', ' if not os.path.exists(dir_param):', ' os.makedirs(dir_param)', ' self.model.save_(dir_param)', ' ', ' def load_model(self, dir_param):', ' self.model.load_(dir_param)', ' ', ' def process_data(self, tra...
[]
Library 'tf' used at line 566 is imported at line 20 and has a Long-Range dependency. Variable 'self' used at line 566 is defined at line 565 and has a Short-Range dependency.
{}
{'Library Long-Range': 1, 'Variable Short-Range': 1}