1 write to Device
Microsoft.ML.TorchSharp (1)
TorchSharpBaseTrainer.cs (1)
159Device = TorchUtils.InitializeDevice(Parent.Host);
14 references to Device
Microsoft.ML.TorchSharp (14)
NasBert\NasBertTrainer.cs (6)
240return DataUtils.CollateTokens(inputTensors, Tokenizer.RobertaModel().PadIndex, device: Device); 250t = torch.tensor((new[] { 0 /* InitToken */ }).Concat(Tokenizer.EncodeToConverted(sentence1.ToString())).ToList(), device: Device); 259.Concat(new[] { 2 /* SeparatorToken */ }).Concat(Tokenizer.EncodeToConverted(sentence2.ToString())).ToList(), device: Device); 278Tensor lengths = torch.tensor(lengthArray, device: Device); 280var inputTensor = PrepareBatchTensor(ref inputTensors, device: Device); 288var inputTensor = PrepareBatchTensor(ref inputTensors, device: Device);
NasBert\NerTrainer.cs (2)
161return torch.tensor(targetArray, device: Device); 190t = torch.tensor((ZeroArray).Concat(Tokenizer.RobertaModel().ConvertIdsToOccurrenceRanks(encoding.Select(t => t.Id).ToArray())).ToList(), device: Device);
NasBert\SentenceSimilarityTrainer.cs (1)
130return torch.tensor(targets, device: Device).@float();
NasBert\TextClassificationTrainer.cs (1)
131return torch.tensor(targets, device: Device);
TorchSharpBaseTrainer.cs (4)
162if (Device.type == DeviceType.CUDA) 258var inputTensor = PrepareBatchTensor(ref inputTensors, device: Device); 259var targetsTensor = CreateTargetsTensor(ref targets, device: Device); 335var targetsTensor = CreateTargetsTensor(ref targets, device: Device);