Skip to content

From Numpy Array to TC Tensor and vice versa #101

Closed

Description

@MuhamedEssam

if i have X with type np.array how can i convert it to be Tinychain Tensor format
So i can use Tc.tensor methods ?

and for the opposite should i use .flatten.tolist() then cast it by np.array()

Activity

  1. MuhamedEssam commented on Feb 15, 2022

    @MuhamedEssam
    ContributorAuthor

    Also do we have .shape Function over here in tinychain ?

  2. MuhamedEssam commented on Feb 15, 2022

    @MuhamedEssam
    ContributorAuthor

    i tested this in numpy and it worked

            self.dbeta = 2/n_samples*(np.einsum("ij,ki->kj", self.beta,
                np.einsum("ij,ki->kj", self.X, self.X.T)) 
                                      - np.einsum("ij,ki->kj", self.y, self.X.T))  
    
    

    can we say that

          d_weights = 2/len(inputs)*(tc.tensor.einsum("ij,ki->kj", weights,
                                                       tc.tensor.einsum("ij,ki->kj", inputs, inputs.transpose))-
                                                          tc.tensor.einsum("ij,ki->kj", labels, inputs.transpose)) 
    
  3. Repository owner locked and limited conversation to collaborators on Feb 15, 2022
  4. converted this issue into a discussion #103 on Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions