TensaCo / tensacode

2 stars 1 forks source link

Implement NNModel.encode_bool, NNModel.encode_int, NNModel.encode_float #6

Open JacobFV opened 2 years ago

JacobFV commented 2 years ago

We need to implement the following methods in NNModel:

Fyi: These method are annotated with @encode.overload which does a lot of magic behind the scenes to route to the appropriate function based on whether encode is called with a bool, int, or float.

JacobFV commented 1 year ago

We don't have a config object for specifying the depth of the vector that is returned, so just make it a constant for now

val = 0.3
enc_val = encode_float(val)
enc_val # ivy.Array? Tensor?[D,]
saurabhya commented 1 year ago

created a pull request for this.

JacobFV commented 1 year ago

Thanks! I am busy right now, but I will review it sometime this weekend

saurabhya commented 1 year ago

I am still unclear about how to handle Boolean values. Can you give explain it with an example?

JacobFV commented 1 year ago

Booleans are encoded as vectors with either all ones or all zeros. No learnable components here.

example

x = False
x_enc = nnmodel.encode_bool(x)
# x_enc = [[0, 0, …, 0]]

On Dec 26, 2022, at 15:23, Saurabh Yadav @.***> wrote:



I am still unclear about how to handle Boolean values. Can you give explain it with an example?

— Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FLimboid%2Ftensorcode%2Fissues%2F6%23issuecomment-1365466794&data=05%7C01%7C%7C3330cabfc3294e095a7208dae7877926%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638076866296602188%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=U3gOSwq6uLI57E50aB%2BhCF%2B8L9zgcSbA%2FrJ%2FZRKN7pI%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJTZS2N3X4XP42DVMRHKOITWPIEGDANCNFSM6AAAAAASQ3GMI4&data=05%7C01%7C%7C3330cabfc3294e095a7208dae7877926%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638076866296602188%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=XrlV90Ki0VQ9EHdcKJUYn7nmx5Dq0MNd%2FwL%2BfL9rC%2Fw%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>