deep learning experiment notes

enumerate()

Objects that support iteration

The enumeration object generates pairs containing a count (from start, which defaults to 0) and a value generated by the iterable parameter.

Enumerate is useful for getting a list of indices:


unique()

Get the unique elements in the array.


map()

df[5] = df[4].map(mapping)

Use the value in df[4] as the key, and get a list of values ​​stored in df[5].


torch.rand()

Returns the initialized tenosr that obeys the uniform distribution, and its shape is its parameter size

U = torch.rand([m,rank], requires_grad = True, dtype=torch.float)


torch.nn.functional.cross_entropy()

torch.nn.functional.cross_entropy (self-calculated value, target value)

Calculate cross entropy

H(p,q)=−i∑​P(i)logQ(i)

Guess you like

Origin blog.csdn.net/qq_39696563/article/details/123305059