def __init__(self): super().__init__() self.virtual_dataset = _VirtualDataset() self.matmul1 = P.MatMul() self.matmul2 = P.MatMul() self.gelu = P.Gelu() self.bn1 = bn_with_initialize(2048)
def __init__(self, strategy0): super(ReshapeNet5, self).__init__() self.virtual_dataset = _VirtualDataset() self.reshape = P.Reshape() self.matmul1 = P.MatMul().shard(strategy0) self.matmul1_weight = Parameter(Tensor(np.ones([25088, 256]), dtype=ms.float32), name="weight") self.matmul2 = P.MatMul().shard(strategy0)
def __init__(self, network, strategy3, strategy4, axis): super(NetWithLoss, self).__init__() self.virtual_dataset = _VirtualDataset() self.one_hot = P.OneHot(axis=axis).set_strategy(strategy3) self.on_value = Tensor(2.0, ms.float32) self.off_value = Tensor(1.0, ms.float32) self.loss = P.SoftmaxCrossEntropyWithLogits().set_strategy(strategy4) self.network = network
def __init__(self, strategy0): super(ReshapeNet3, self).__init__() self.virtual_dataset = _VirtualDataset() self.reshape = P.Reshape() self.matmul = P.MatMul().shard(strategy0) self.matmul_weight = Parameter(Tensor(np.ones([25088, 256]), dtype=ms.float32), name="weight") self.reshape2 = P.Reshape() self.reduce_sum = P.ReduceSum(keep_dims=False) self.reshape3 = P.Reshape()
def __init__(self, strategy0, strategy1, strategy2, strategy3): super().__init__() self.virtual_dataset = _VirtualDataset().set_strategy(strategy0) self.matmul1 = P.MatMul().set_strategy(strategy1) self.matmul2 = P.MatMul().set_strategy(strategy2) self.gelu = P.Gelu().set_strategy(strategy3)
def __init__(self, backbone): super(VirtualDatasetOneInputCell, self).__init__(auto_prefix=False) self._backbone = backbone self._virtual_dataset = _VirtualDataset()
def __init__(self): super(VirtualDatasetNet, self).__init__() self.virtual_dataset = _VirtualDataset() self.matmul1 = P.MatMul() self.matmul2 = P.MatMul() self.gelu = P.Gelu()
def __init__(self, strategy1, strategy2, num_segments): super(Net, self).__init__() self.virtual_dataset = _VirtualDataset() self.merge_op = P.UnsortedSegmentSum().shard((strategy1, strategy2)) self.num_segments = num_segments