1 write to Device
Microsoft.ML.TorchSharp (1)
TorchSharpBaseTrainer.cs (1)
159
Device
= TorchUtils.InitializeDevice(Parent.Host);
14 references to Device
Microsoft.ML.TorchSharp (14)
NasBert\NasBertTrainer.cs (6)
240
return DataUtils.CollateTokens(inputTensors, Tokenizer.RobertaModel().PadIndex, device:
Device
);
250
t = 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
);
278
Tensor lengths = torch.tensor(lengthArray, device:
Device
);
280
var inputTensor = PrepareBatchTensor(ref inputTensors, device:
Device
);
288
var inputTensor = PrepareBatchTensor(ref inputTensors, device:
Device
);
NasBert\NerTrainer.cs (2)
161
return torch.tensor(targetArray, device:
Device
);
190
t = torch.tensor((ZeroArray).Concat(Tokenizer.RobertaModel().ConvertIdsToOccurrenceRanks(encoding.Select(t => t.Id).ToArray())).ToList(), device:
Device
);
NasBert\SentenceSimilarityTrainer.cs (1)
129
return torch.tensor(targets, device:
Device
).@float();
NasBert\TextClassificationTrainer.cs (1)
130
return torch.tensor(targets, device:
Device
);
TorchSharpBaseTrainer.cs (4)
162
if (
Device
.type == DeviceType.CUDA)
258
var inputTensor = PrepareBatchTensor(ref inputTensors, device:
Device
);
259
var targetsTensor = CreateTargetsTensor(ref targets, device:
Device
);
335
var targetsTensor = CreateTargetsTensor(ref targets, device:
Device
);