torch.rand/randn/randint
by Jerry Su, post on Jan 04, 2021Reason is the light and the light of life.
torch.nn.CrossEntropyLoss
by Jerry Su, post on Jan 04, 2021Reason is the light and the light of life.
Python - Generator
by Jerry Su, post on Dec 30, 2020函数体中存在yield关键字,即为生成器。调用生成器函数会返回一个生成器对象。即生成器函数就是生成器工厂。
生成器是迭代器。
def …
Python - Iterable vs Iterator
by Jerry Su, post on Dec 30, 2020import re
from collections.abc import Iterator, Iterable
鸭子类型,通过协议实现
1. Iterable
可迭代协议: __iter__()
import re
class Sentence1:
def __init__(self, text …