From ad0161891a4795fa99274d795cc2089c5c41743c Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:26:46 +0200 Subject: [PATCH] Fix non-breaking typos --- autograd/context.v | 2 +- autograd/gate.v | 2 +- autograd/gates_basic.v | 8 ++++---- autograd/variable.v | 4 ++-- datasets/loader.v | 2 +- examples/vtl_opencl_vcl_support/README.md | 2 +- src/fun.v | 6 ++---- stats/stats.v | 12 ++++++------ storage/cpu.v | 4 ++-- 9 files changed, 20 insertions(+), 22 deletions(-) diff --git a/autograd/context.v b/autograd/context.v index ddd84d06..dc7d3a37 100644 --- a/autograd/context.v +++ b/autograd/context.v @@ -13,7 +13,7 @@ pub mut: // This list can contain duplicates nodes []&Node[T] // If no_grad is set to true, operations will not - // be cached, and backpropogation will not be possible + // be cached, and backpropagation will not be possible no_grad bool } diff --git a/autograd/gate.v b/autograd/gate.v index a897c9d4..2e19108a 100644 --- a/autograd/gate.v +++ b/autograd/gate.v @@ -5,7 +5,7 @@ import vtl pub interface CacheParam {} // Gate is an object that can cache the result of an operation, -// as well as backpropogate a payload backwards along the +// as well as backpropagate a payload backwards along the // computational graph // // Structs that implement from this interface can add instance diff --git a/autograd/gates_basic.v b/autograd/gates_basic.v index 0a7df1b4..3d3e409b 100644 --- a/autograd/gates_basic.v +++ b/autograd/gates_basic.v @@ -45,8 +45,8 @@ pub fn subtract_gate[T]() &SubstractGate[T] { pub fn (g &SubstractGate[T]) backward[T](payload &Payload[T]) ![]&vtl.Tensor[T] { gradient := payload.variable.grad - oposite := gradient.multiply_scalar[T](vtl.cast[T](-1))! - return [gradient, oposite] + opposite := gradient.multiply_scalar[T](vtl.cast[T](-1))! + return [gradient, opposite] } pub fn (g &SubstractGate[T]) cache[T](mut result Variable[T], args ...CacheParam) ! { @@ -134,8 +134,8 @@ pub fn (g &DivideGate[T]) backward[T](payload &Payload[T]) ![]&vtl.Tensor[T] { gradient := payload.variable.grad r0 := gradient.divide[T](g.b.value)! bx2 := g.b.value.multiply_scalar[T](vtl.cast[T](2))! - oposite := gradient.multiply_scalar[T](vtl.cast[T](-1))! - mut r1 := oposite.multiply[T](g.a.value)! + opposite := gradient.multiply_scalar[T](vtl.cast[T](-1))! + mut r1 := opposite.multiply[T](g.a.value)! r1 = r1.divide[T](bx2)! return [r0, r1] } diff --git a/autograd/variable.v b/autograd/variable.v index fe19e1ae..f516be67 100644 --- a/autograd/variable.v +++ b/autograd/variable.v @@ -5,7 +5,7 @@ import vtl // Variable is an abstraction of a vtl.Tensor that tracks // the operations done to the vtl.Tensor. It also keeps // track of the gradient of the operation if a Variable -// needs to backpropogate. +// needs to backpropagate. // This is the fundamental object used in automatic // differentiation, as well as the neural network aspects // of VTL @@ -64,7 +64,7 @@ pub fn (v &Variable[T]) str() string { return v.value.str() } -// backprop Back propogates an operation along a computational graph. +// backprop Back propagates an operation along a computational graph. // This operation will destroy the operational graph, populating // the gradients for all variables that are predecessors of // the Variable this is called on. diff --git a/datasets/loader.v b/datasets/loader.v index f7f7a3ff..151db68a 100644 --- a/datasets/loader.v +++ b/datasets/loader.v @@ -48,7 +48,7 @@ struct DatasetDownload { fn download_dataset(data DatasetDownload) !string { dataset_dir := os.real_path(get_cache_dir('datasets', data.dataset)) - // Handline extensions like `*.tar.gz`. + // Handle extensions like `*.tar.gz`. exts := os.file_name(data.file).rsplit_nth('.', 3) is_tar := exts[0] == 'tar' || (exts.len > 1 && exts[1] == 'tar') diff --git a/examples/vtl_opencl_vcl_support/README.md b/examples/vtl_opencl_vcl_support/README.md index 45dcf838..b1cd538c 100644 --- a/examples/vtl_opencl_vcl_support/README.md +++ b/examples/vtl_opencl_vcl_support/README.md @@ -4,7 +4,7 @@ This example shows how to use the OpenCL backend with VCL support. ## Prerequisites -Read the [docs](https://vlang.github.io/vsl/vcl.html) of the V Computating Language (VCL) and the OpenCL backend. +Read the [docs](https://vlang.github.io/vsl/vcl.html) of the V Computing Language (VCL) and the OpenCL backend. ## Running the example diff --git a/src/fun.v b/src/fun.v index 6381f922..a430ffe4 100644 --- a/src/fun.v +++ b/src/fun.v @@ -167,15 +167,13 @@ pub fn (t &Tensor[T]) transpose[T](order []int) !&Tensor[T] { return ret } -// t returns a ful transpose of an tensor, with the axes -// reversed +// t returns a full transpose of a tensor, with the axes reversed pub fn (t &Tensor[T]) t[T]() !&Tensor[T] { order := irange(0, t.rank()) return t.transpose(order.reverse()) } -// swapaxes returns a view of an tensor with two axes -// swapped. +// swapaxes returns a view of an tensor with two axes swapped pub fn (t &Tensor[T]) swapaxes[T](a1 int, a2 int) !&Tensor[T] { mut order := irange(0, t.rank()) tmp := order[a1] diff --git a/stats/stats.v b/stats/stats.v index 3c8f1b72..24557402 100644 --- a/stats/stats.v +++ b/stats/stats.v @@ -79,7 +79,7 @@ pub fn prod_axis_with_dims[T](t &vtl.Tensor[T], data AxisData) T { return acc } -// Measure of Occurance +// Measure of Occurrence // Frequency of a given number // Based on // https://www.mathsisfun.com/data/frequency-distribution.html @@ -99,7 +99,7 @@ pub fn freq[T](t &vtl.Tensor[T], val T) int { return count } -// Measure of Central Tendancy +// Measure of Central Tendency // Mean of the given input array // Based on // https://www.mathsisfun.com/data/central-measures.html @@ -113,7 +113,7 @@ pub fn mean[T](t &vtl.Tensor[T]) T { }) / vtl.cast[T](t.size) } -// Measure of Central Tendancy +// Measure of Central Tendency // Geometric Mean of the given input array // Based on // https://www.mathsisfun.com/numbers/geometric-mean.html @@ -128,7 +128,7 @@ pub fn geometric_mean[T](t &vtl.Tensor[T]) T { return math.pow(prod, vtl.cast[T](1) / vtl.cast[T](t.size)) } -// Measure of Central Tendancy +// Measure of Central Tendency // Harmonic Mean of the given input array // Based on // https://www.mathsisfun.com/numbers/harmonic-mean.html @@ -142,7 +142,7 @@ pub fn harmonic_mean[T](t &vtl.Tensor[T]) T { }) } -// Measure of Central Tendancy +// Measure of Central Tendency // Median of the given input array ( input array is assumed to be sorted ) // Based on // https://www.mathsisfun.com/data/central-measures.html @@ -158,7 +158,7 @@ pub fn median[T](t &vtl.Tensor[T]) T { } } -// Measure of Central Tendancy +// Measure of Central Tendency // Mode of the given input array // Based on // https://www.mathsisfun.com/data/central-measures.html diff --git a/storage/cpu.v b/storage/cpu.v index 0730105a..285fc642 100644 --- a/storage/cpu.v +++ b/storage/cpu.v @@ -25,13 +25,13 @@ pub fn from_array[T](arr []T) &CpuStorage[T] { } } -// Private function. Used to implement Storage operator +// Private function. Used to implement the Storage operator @[inline] pub fn (s &CpuStorage[T]) get[T](i int) T { return s.data[i] } -// Private function. Used to implement assigment to the Storage element +// Private function. Used to implement assignments to the Storage element @[inline] pub fn (mut s CpuStorage[T]) set[T](i int, val T) { s.data[i] = val