Skip to content

Commit 948ff85

Browse files
committed
Removing unnecessary backslashes
1 parent 3c0fc62 commit 948ff85

File tree

8 files changed

+48
-48
lines changed

8 files changed

+48
-48
lines changed

arrayfire/algorithm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ def sort(a, dim=0, is_ascending=True):
120120
def sort_index(a, dim=0, is_ascending=True):
121121
out = Array()
122122
idx = Array()
123-
safe_call(clib.af_sort_index(ct.pointer(out.arr), ct.pointer(idx.arr), a.arr, \
123+
safe_call(clib.af_sort_index(ct.pointer(out.arr), ct.pointer(idx.arr), a.arr,
124124
ct.c_uint(dim), ct.c_bool(is_ascending)))
125125
return out,idx
126126

127127
def sort_by_key(iv, ik, dim=0, is_ascending=True):
128128
ov = Array()
129129
ok = Array()
130-
safe_call(clib.af_sort_by_key(ct.pointer(ov.arr), ct.pointer(ok.arr), \
130+
safe_call(clib.af_sort_by_key(ct.pointer(ov.arr), ct.pointer(ok.arr),
131131
iv.arr, ik.arr, ct.c_uint(dim), ct.c_bool(is_ascending)))
132132
return ov,ok
133133

arrayfire/array.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def constant_array(val, d0, d1=None, d2=None, d3=None, dtype=f32):
3939
if (dtype != c32 and dtype != c64):
4040
dtype = c32
4141

42-
safe_call(clib.af_constant_complex(ct.pointer(out), c_real, c_imag,\
42+
safe_call(clib.af_constant_complex(ct.pointer(out), c_real, c_imag,
4343
4, ct.pointer(dims), dtype))
4444
elif dtype == s64:
4545
c_val = ct.c_longlong(val.real)
@@ -206,7 +206,7 @@ def dims(self):
206206
d1 = ct.c_longlong(0)
207207
d2 = ct.c_longlong(0)
208208
d3 = ct.c_longlong(0)
209-
safe_call(clib.af_get_dims(ct.pointer(d0), ct.pointer(d1),\
209+
safe_call(clib.af_get_dims(ct.pointer(d0), ct.pointer(d1),
210210
ct.pointer(d2), ct.pointer(d3), self.arr))
211211
dims = (d0.value,d1.value,d2.value,d3.value)
212212
return dims[:self.numdims()]
@@ -428,7 +428,7 @@ def __getitem__(self, key):
428428
n_dims = self.numdims()
429429
inds = get_indices(key, n_dims)
430430

431-
safe_call(clib.af_index_gen(ct.pointer(out.arr),\
431+
safe_call(clib.af_index_gen(ct.pointer(out.arr),
432432
self.arr, ct.c_longlong(n_dims), ct.pointer(inds)))
433433
return out
434434
except RuntimeError as e:
@@ -448,8 +448,8 @@ def __setitem__(self, key, val):
448448
out_arr = ct.c_void_p(0)
449449
inds = get_indices(key, n_dims)
450450

451-
safe_call(clib.af_assign_gen(ct.pointer(out_arr),\
452-
self.arr, ct.c_longlong(n_dims), ct.pointer(inds),\
451+
safe_call(clib.af_assign_gen(ct.pointer(out_arr),
452+
self.arr, ct.c_longlong(n_dims), ct.pointer(inds),
453453
other_arr))
454454
safe_call(clib.af_release_array(self.arr))
455455
self.arr = out_arr

arrayfire/blas.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@
1212

1313
def matmul(lhs, rhs, lhs_opts=AF_MAT_NONE, rhs_opts=AF_MAT_NONE):
1414
out = Array()
15-
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,\
15+
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,
1616
lhs_opts, rhs_opts))
1717
return out
1818

1919
def matmulTN(lhs, rhs):
2020
out = Array()
21-
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,\
21+
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,
2222
AF_MAT_TRANS, AF_MAT_NONE))
2323
return out
2424

2525
def matmulNT(lhs, rhs):
2626
out = Array()
27-
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,\
27+
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,
2828
AF_MAT_NONE, AF_MAT_TRANS))
2929
return out
3030

3131
def matmulTT(lhs, rhs):
3232
out = Array()
33-
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,\
33+
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,
3434
AF_MAT_TRANS, AF_MAT_TRANS))
3535
return out
3636

3737
def dot(lhs, rhs, lhs_opts=AF_MAT_NONE, rhs_opts=AF_MAT_NONE):
3838
out = Array()
39-
safe_call(clib.af_dot(ct.pointer(out.arr), lhs.arr, rhs.arr,\
39+
safe_call(clib.af_dot(ct.pointer(out.arr), lhs.arr, rhs.arr,
4040
lhs_opts, rhs_opts))
4141
return out

arrayfire/device.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def device_info():
2020
toolkit = ct.c_char_256()
2121
compute = ct.c_char_256()
2222

23-
safe_call(clib.af_device_info(ct.pointer(device_name), ct.pointer(backend_name), \
23+
safe_call(clib.af_device_info(ct.pointer(device_name), ct.pointer(backend_name),
2424
ct.pointer(toolkit), ct.pointer(compute)))
2525
dev_info = {}
2626
dev_info['device'] = to_str(device_name)
@@ -58,7 +58,7 @@ def device_mem_info():
5858
alloc_buffers = ct.c_size_t(0)
5959
lock_bytes = ct.c_size_t(0)
6060
lock_buffers = ct.c_size_t(0)
61-
safe_call(clib.af_device_mem_info(ct.pointer(alloc_bytes), ct.pointer(alloc_buffers),\
61+
safe_call(clib.af_device_mem_info(ct.pointer(alloc_bytes), ct.pointer(alloc_buffers),
6262
ct.pointer(lock_bytes), ct.pointer(lock_buffers)))
6363
mem_info = {}
6464
mem_info['alloc'] = {'buffers' : alloc_buffers.value, 'bytes' : alloc_bytes.value}

arrayfire/graphics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, width=None, height=None, title=None):
3636

3737
_title = _title.encode("ascii")
3838

39-
safe_call(clib.af_create_window(ct.pointer(self._wnd),\
39+
safe_call(clib.af_create_window(ct.pointer(self._wnd),
4040
ct.c_int(_width), ct.c_int(_height), ct.c_char_p(_title)))
4141

4242
def __del__(self):
@@ -61,8 +61,8 @@ def plot(self, X, Y, title=None):
6161

6262
def hist(self, X, min_val, max_val, title=None):
6363
_cell = Cell(self._r, self._c, title, self._cmap)
64-
safe_call(clib.af_draw_hist(self._wnd, X.arr, \
65-
ct.c_double(max_val), ct.c_double(min_val),\
64+
safe_call(clib.af_draw_hist(self._wnd, X.arr,
65+
ct.c_double(max_val), ct.c_double(min_val),
6666
ct.pointer(_cell)))
6767

6868
def grid(rows, cols):

arrayfire/image.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def gradient(image):
2121
def load_image(file_name, is_color=False):
2222
assert(os.path.isfile(file_name))
2323
image = Array()
24-
safe_call(clib.af_load_image(ct.pointer(image.arr), \
24+
safe_call(clib.af_load_image(ct.pointer(image.arr),
2525
ct.c_char_p(file_name.encode('ascii')), is_color))
2626
return image
2727

@@ -41,15 +41,15 @@ def resize(image, scale=None, odim0=None, odim1=None, method=AF_INTERP_NEAREST):
4141
odim1 = int(scale * idims[1])
4242

4343
output = Array()
44-
safe_call(clib.af_resize(ct.pointer(output.arr),\
44+
safe_call(clib.af_resize(ct.pointer(output.arr),
4545
image.arr, ct.c_longlong(odim0), ct.c_longlong(odim1), method))
4646

4747
return output
4848

4949
def transform(image, transform, odim0 = 0, odim1 = 0, method=AF_INTERP_NEAREST, is_inverse=True):
5050
output = Array()
51-
safe_call(clib.af_transform(ct.pointer(output.arr),\
52-
image.arr, transform.arr,\
51+
safe_call(clib.af_transform(ct.pointer(output.arr),
52+
image.arr, transform.arr,
5353
ct.c_longlong(odim0), ct.c_longlong(odim1), method, is_inverse))
5454
return output
5555

@@ -60,21 +60,21 @@ def rotate(image, theta, is_crop = True, method = AF_INTERP_NEAREST):
6060

6161
def translate(image, trans0, trans1, odim0 = 0, odim1 = 0, method = AF_INTERP_NEAREST):
6262
output = Array()
63-
safe_call(clib.af_translate(ct.pointer(output.arr), \
63+
safe_call(clib.af_translate(ct.pointer(output.arr),
6464
image.arr, trans0, trans1, ct.c_longlong(odim0), ct.c_longlong(odim1), method))
6565
return output
6666

6767
def scale(image, scale0, scale1, odim0 = 0, odim1 = 0, method = AF_INTERP_NEAREST):
6868
output = Array()
69-
safe_call(clib.af_scale(ct.pointer(output.arr),\
70-
image.arr, ct.c_double(scale0), ct.c_double(scale1),\
69+
safe_call(clib.af_scale(ct.pointer(output.arr),
70+
image.arr, ct.c_double(scale0), ct.c_double(scale1),
7171
ct.c_longlong(odim0), ct.c_longlong(odim1), method))
7272
return output
7373

7474
def skew(image, skew0, skew1, odim0 = 0, odim1 = 0, method = AF_INTERP_NEAREST, is_inverse=True):
7575
output = Array()
76-
safe_call(clib.af_skew(ct.pointer(output.arr),\
77-
image.arr, ct.c_double(skew0), ct.c_double(skew1), \
76+
safe_call(clib.af_skew(ct.pointer(output.arr),
77+
image.arr, ct.c_double(skew0), ct.c_double(skew1),
7878
ct.c_longlong(odim0), ct.c_longlong(odim1), method, is_inverse))
7979

8080
return output
@@ -90,7 +90,7 @@ def histogram(image, nbins, min_val = None, max_val = None):
9090
max_val = af_max(image)
9191

9292
output = Array()
93-
safe_call(clib.af_histogram(ct.pointer(output.arr),\
93+
safe_call(clib.af_histogram(ct.pointer(output.arr),
9494
image.arr, ct.c_uint(nbins), ct.c_double(min_val), ct.c_double(max_val)))
9595
return output
9696

@@ -141,32 +141,32 @@ def erode3(image, mask = None):
141141

142142
def bilateral(image, s_sigma, c_sigma, is_color = False):
143143
output = Array()
144-
safe_call(clib.af_bilateral(ct.pointer(output.arr),\
144+
safe_call(clib.af_bilateral(ct.pointer(output.arr),
145145
image.arr, ct.c_double(s_sigma), ct.c_double(c_sigma), is_color))
146146
return output
147147

148148
def mean_shift(image, s_sigma, c_sigma, n_iter, is_color = False):
149149
output = Array()
150-
safe_call(clib.af_mean_shift(ct.pointer(output.arr),\
151-
image.arr, ct.c_double(s_sigma), ct.c_double(c_sigma),\
150+
safe_call(clib.af_mean_shift(ct.pointer(output.arr),
151+
image.arr, ct.c_double(s_sigma), ct.c_double(c_sigma),
152152
ct.c_uint(n_iter), is_color))
153153
return output
154154

155155
def medfilt(image, w_len = 3, w_wid = 3, edge_pad = AF_PAD_ZERO):
156156
output = Array()
157-
safe_call(clib.af_medfilt(ct.pointer(output.arr), \
157+
safe_call(clib.af_medfilt(ct.pointer(output.arr),
158158
image.arr, ct.c_longlong(w_len), ct.c_longlong(w_wid), edge_pad))
159159
return output
160160

161161
def minfilt(image, w_len = 3, w_wid = 3, edge_pad = AF_PAD_ZERO):
162162
output = Array()
163-
safe_call(clib.af_minfilt(ct.pointer(output.arr), \
163+
safe_call(clib.af_minfilt(ct.pointer(output.arr),
164164
image.arr, ct.c_longlong(w_len), ct.c_longlong(w_wid), edge_pad))
165165
return output
166166

167167
def maxfilt(image, w_len = 3, w_wid = 3, edge_pad = AF_PAD_ZERO):
168168
output = Array()
169-
safe_call(clib.af_maxfilt(ct.pointer(output.arr), \
169+
safe_call(clib.af_maxfilt(ct.pointer(output.arr),
170170
image.arr, ct.c_longlong(w_len), ct.c_longlong(w_wid), edge_pad))
171171
return output
172172

@@ -178,7 +178,7 @@ def regions(image, connectivity = AF_CONNECTIVITY_4, out_type = f32):
178178
def sobel_derivatives(image, w_len=3):
179179
dx = Array()
180180
dy = Array()
181-
safe_call(clib.af_sobel_operator(ct.pointer(dx.arr), ct.pointer(dy.arr),\
181+
safe_call(clib.af_sobel_operator(ct.pointer(dx.arr), ct.pointer(dy.arr),
182182
image.arr, ct.c_uint(w_len)))
183183
return dx,dy
184184

@@ -194,13 +194,13 @@ def sobel_filter(image, w_len = 3, is_fast = False):
194194

195195
def rgb2gray(image, r_factor = 0.2126, g_factor = 0.7152, b_factor = 0.0722):
196196
output=Array()
197-
safe_call(clib.af_rgb2gray(ct.pointer(output.arr), \
197+
safe_call(clib.af_rgb2gray(ct.pointer(output.arr),
198198
image.arr, ct.c_float(r_factor), ct.c_float(g_factor), ct.c_float(b_factor)))
199199
return output
200200

201201
def gray2rgb(image, r_factor = 1.0, g_factor = 1.0, b_factor = 1.0):
202202
output=Array()
203-
safe_call(clib.af_gray2rgb(ct.pointer(output.arr), \
203+
safe_call(clib.af_gray2rgb(ct.pointer(output.arr),
204204
image.arr, ct.c_float(r_factor), ct.c_float(g_factor), ct.c_float(b_factor)))
205205
return output
206206

arrayfire/signal.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
def approx1(signal, pos0, method=AF_INTERP_LINEAR, off_grid=0.0):
1414
output = Array()
15-
safe_call(clib.af_approx1(ct.pointer(output.arr), signal.arr, pos0.arr,\
15+
safe_call(clib.af_approx1(ct.pointer(output.arr), signal.arr, pos0.arr,
1616
method, ct.c_double(off_grid)))
1717
return output
1818

1919
def approx2(signal, pos0, pos1, method=AF_INTERP_LINEAR, off_grid=0.0):
2020
output = Array()
21-
safe_call(clib.af_approx2(ct.pointer(output.arr), signal.arr, \
21+
safe_call(clib.af_approx2(ct.pointer(output.arr), signal.arr,
2222
pos0.arr, pos1.arr, method, ct.c_double(off_grid)))
2323
return output
2424

@@ -46,7 +46,7 @@ def fft2(signal, dim0 = None, dim1 = None , scale = None):
4646
scale = 1.0
4747

4848
output = Array()
49-
safe_call(clib.af_fft2(ct.pointer(output.arr), signal.arr, ct.c_double(scale),\
49+
safe_call(clib.af_fft2(ct.pointer(output.arr), signal.arr, ct.c_double(scale),
5050
ct.c_longlong(dim0), ct.c_longlong(dim1)))
5151
return output
5252

@@ -65,7 +65,7 @@ def fft3(signal, dim0 = None, dim1 = None , dim2 = None, scale = None):
6565
scale = 1.0
6666

6767
output = Array()
68-
safe_call(clib.af_fft3(ct.pointer(output.arr), signal.arr, ct.c_double(scale),\
68+
safe_call(clib.af_fft3(ct.pointer(output.arr), signal.arr, ct.c_double(scale),
6969
ct.c_longlong(dim0), ct.c_longlong(dim1), ct.c_longlong(dim2)))
7070
return output
7171

@@ -98,7 +98,7 @@ def ifft2(signal, dim0 = None, dim1 = None , scale = None):
9898
scale = 1.0/float(dim0 * dim1)
9999

100100
output = Array()
101-
safe_call(clib.af_ifft2(ct.pointer(output.arr), signal.arr, ct.c_double(scale),\
101+
safe_call(clib.af_ifft2(ct.pointer(output.arr), signal.arr, ct.c_double(scale),
102102
ct.c_longlong(dim0), ct.c_longlong(dim1)))
103103
return output
104104

@@ -122,7 +122,7 @@ def ifft3(signal, dim0 = None, dim1 = None , dim2 = None, scale = None):
122122
scale = 1.0 / float(dim0 * dim1 * dim2)
123123

124124
output = Array()
125-
safe_call(clib.af_ifft3(ct.pointer(output.arr), signal.arr, ct.c_double(scale),\
125+
safe_call(clib.af_ifft3(ct.pointer(output.arr), signal.arr, ct.c_double(scale),
126126
ct.c_longlong(dim0), ct.c_longlong(dim1), ct.c_longlong(dim2)))
127127
return output
128128

arrayfire/vision.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@
1212

1313
def fast(image, threshold=20.0, arc_length=9, non_max=True, feature_ratio=0.05, edge=3):
1414
out = Features()
15-
safe_call(clib.af_fast(ct.pointer(out.feat),\
16-
image.arr, ct.c_float(threshold), ct.c_uint(arc_length), non_max, \
15+
safe_call(clib.af_fast(ct.pointer(out.feat),
16+
image.arr, ct.c_float(threshold), ct.c_uint(arc_length), non_max,
1717
ct.c_float(feature_ratio), ct.c_uint(edge)))
1818
return out
1919

2020
def orb(image, threshold=20.0, max_features=400, scale = 1.5, num_levels = 4, blur_image = False):
2121
feat = Features()
2222
desc = Array()
23-
safe_call(clib.af_orb(ct.pointer(feat.feat), ct.pointer(desc.arr),\
24-
ct.c_float(threshold), ct.c_uint(max_features),\
23+
safe_call(clib.af_orb(ct.pointer(feat.feat), ct.pointer(desc.arr),
24+
ct.c_float(threshold), ct.c_uint(max_features),
2525
ct.c_float(scale), ct.c_uint(num_levels), blur_image))
2626
return feat, desc
2727

2828
def hamming_matcher(query, database, dim = 0, num_nearest = 1):
2929
index = Array()
3030
dist = Array()
31-
safe_call(clib.af_hamming_matcher(ct.pointer(idx.arr), ct.pointer(dist.arr),\
32-
query.arr, database.arr, \
31+
safe_call(clib.af_hamming_matcher(ct.pointer(idx.arr), ct.pointer(dist.arr),
32+
query.arr, database.arr,
3333
ct.c_longlong(dim), ct.c_longlong(num_nearest)))
3434
return index, dist
3535

0 commit comments

Comments
 (0)