This is an edge case and copy() takes care of this already. It's better to optimize for the usual case.
n := src.TypedLen(t)
if len(dst.Raw) < n {
n = dst.TypedLen(t)
}
// handle struct{} type
if t.Size() == 0 {
return n
}
Empty structs don't work with tensors. If you try to create one it will panic or error. It's Dtype is also not defined. Although you could still try to create one using WithBacking(). Maybe we could return a more explicit error if you try to create one at some point.
Coverage decreased (-0.01%) to 73.021% when pulling b4f9cc49d15764976f8a2f02b62488d08f234592 on MarkKremer:markkremer_remove_redundant_code_from_header_copy_func into cb074974725cfacb47b7122fc4a2f8ed1004a883 on gorgonia:master.
First merge my other PR because it uses the same fixed test helper.
This is just a dumb small PR. I removed some code that I thought was redundant:
This is an edge case and
copy()
takes care of this already. It's better to optimize for the usual case.Empty structs don't work with tensors. If you try to create one it will panic or error. It's
Dtype
is also not defined. Although you could still try to create one usingWithBacking()
. Maybe we could return a more explicit error if you try to create one at some point.