-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to understand downsampling #20
Comments
Can you explain line 346 what is in the |
I refer you to this, especially the image |
Oh, I have understood |
Ah ok. |
Simulation of FHEController 1191-1194 def rot(nums,index):
index=index%len(nums)
if(index>0):
return nums[index:]+nums[:index]
else:
return nums[-index:]+nums[:-index]
def create_vec(n):
res=[]
for i in range(1,n+1):
line=[i]
res.append(line)
return res
def vec_add(vec1,vec2):
for i in range(len(vec1)):
if vec2[i]==[0]:
continue
elif vec1[i]==[0]:
vec1[i]=vec2[i]
else:
vec1[i].extend(vec2[i])
return vec1
def vec_mult(vec1,vec2):
for i in range(len(vec1)):
if vec2[i]==0:
vec1[i]=[0]
return vec1
def gen_mask(n):
mask=[]
ci=n
for i in range(1,32*32*32+1):
if ci>0 :
mask.append(1)
else:
mask.append(0)
ci-=1
if ci<=-n:
ci=n
return mask
if __name__ == '__main__':
with open('test.txt','w') as f:
fullpacke=create_vec(32*32*32)
fullpacke=vec_mult(vec_add(fullpacke,rot(fullpacke,1)),gen_mask(2))
f.write(str(fullpacke))
f.write('\n------------------------------------------------------------------------------------------\n')
fullpacke=vec_mult(vec_add(fullpacke,rot(fullpacke,2)),gen_mask(4))
f.write(str(fullpacke))
f.write('\n------------------------------------------------------------------------------------------\n')
fullpacke=vec_mult(vec_add(fullpacke,rot(fullpacke,4)),gen_mask(8))
f.write(str(fullpacke))
f.write('\n------------------------------------------------------------------------------------------\n')
fullpacke=vec_add(fullpacke,rot(fullpacke,8))
f.write(str(fullpacke)) I am very sorry that I have been simulating your program, the numbers in my code represent subscripts, maybe there is something wrong with my writing, I am different from the diagram you gave, could you give me an example about the subsampling code? Thank you very much. |
how do you select the rotation or mask index in the downsample function? about the index 1,2,8? Are these numbers related to the stride or downsampe size and others? |
|
Hello, I'm very sorry to bother you again. When I read your source code, I don't quite understand how your downsampling is calculated. Could you explain it to me, because it is just a simple description in your paper.
The text was updated successfully, but these errors were encountered: