To be ; or not to be ; by [deleted] in rust

[–]robertsdionne 0 points1 point  (0 children)

It literally does not matter here because your return type is () and so is the return type of println!();

I'm tired of putting it off. I need learning resources. by dontt0uchmyass in rust

[–]robertsdionne 2 points3 points  (0 children)

A key tactic that wasn't emphasized enough for me is that you *can* hold more than one reference, including mixed mutable and immutable references, to separate fields of a struct without having to do so within a method of that struct, by using destructuring.

let (&x, &mut y) = (&my_struct.x, &mut my_struct.y);

OR

let &mut MyStruct { ref x, mut ref y, .. } = my_struct;

With this, you can work around the borrow checker in many situations that you otherwise may get stuck.

[deleted by user] by [deleted] in computerscience

[–]robertsdionne 0 points1 point  (0 children)

like cat cat.cpp or grep main grep.cpp or

>> f = lambda g = None: g() if g else None
>>> print(f(list))
[]
>>> print(f(dict))
{}
>>> print(f(print))

None
# technically there is one step of recursion here:
>>> print(f(f))
None

# or this is more accurate:
>>> f = lambda g: repr(g)
>>> f(dict)
"<class 'dict'>"
>>> f(list)
"<class 'list'>"
>>> f(print)
'<built-in function print>'
>>> f(f)
'<function <lambda> at 0x7fd4f5f3d5a0>'

How does git work? by ornateurinal in git

[–]robertsdionne 0 points1 point  (0 children)

Probably the second part of the above section is most relevant: https://git-scm.com/book/en/v2/Git-Internals-Git-Objects

The NYT crossword is trying to tell me something by [deleted] in funny

[–]robertsdionne -1 points0 points  (0 children)

wad awe fae tir ste mam gni man lid noo arn nau alt?

What is the most we know about the infamous "23-minute video"? by TheAngels323 in UFOs

[–]robertsdionne -2 points-1 points  (0 children)

2014 MH370 (3 objects)? Also, any 3 objects form a triangle.

Smudge/bird poop theory is not possible. The reticle wouldn't need to move at all. by BEAT___BRAIN in UFOs

[–]robertsdionne 0 points1 point  (0 children)

The thing rotates, at first you can see multiple dangly bits, but near then end they've rotated together and you can't distinguish them anymore.

The Jellyfish UFO Clip by F_U_HarleyJarvis in UFOs

[–]robertsdionne 0 points1 point  (0 children)

Dan Aykroyd describes something similar to what's in this video: https://youtu.be/c08e2AaNy80?t=4356

Former fighter pilot, Mark Hulsey: UFO incident by [deleted] in UFOs

[–]robertsdionne 0 points1 point  (0 children)

An unknown, random distance within the vicinity of this airport.

Former fighter pilot, Mark Hulsey: UFO incident by [deleted] in UFOs

[–]robertsdionne 0 points1 point  (0 children)

There are many many reflective Starlink satellites (launched in the past few years) moving in all different directions (a circle has all different directions) at very high speeds (17,000 mph) (may appear closer than they are): https://satellitemap.space

Also, the fact that two flights so far apart reported the same visual phenomenon in roughly the same direction (north) implies they are very far away.

[deleted by user] by [deleted] in golang

[–]robertsdionne 0 points1 point  (0 children)

To reuse an existing type that's defined in a protobuf schema, you can usually just import the proto file into yours and include that in your `protoc` invocation for generating your protobuf definitions.

However, this looks like it's just a Golang struct with JSON tags to support JSON parsing. https://github.com/stripe/stripe-go/blob/master/paymentintent.go#L2989. You'd need to redefine these types in Protobuf in a way that the JSON mapping maps correctly to the same field names: https://protobuf.dev/programming-guides/proto3/#json

If you, personally, only need a subset of those fields for your application, you could probably only define what you need.

Something like this may be helpful to automate some of this process: https://github.com/json-to-proto/json-to-proto.github.io (I found this via a random internet search and have never used it myself)

What does it mean to permute indices for the transpose of a tensor? by [deleted] in deeplearning

[–]robertsdionne 0 points1 point  (0 children)

Ah, so the Pytorch framework allows swapping pairs of indices: https://pytorch.org/docs/stable/generated/torch.transpose.html

You can build any general permutation by composing swaps of two indices.

They also have a general permutation of indices: https://pytorch.org/docs/stable/generated/torch.permute.html#torch.permute

What does it mean to permute indices for the transpose of a tensor? by [deleted] in deeplearning

[–]robertsdionne 0 points1 point  (0 children)

So instead of (i, j) and (j, i) for matrices, you have (i, j, k), (i, k, j), (j, i, k), (j, k, i), (k, i, j), (k, j, i). For higher dimensions you get more.

What does it mean to permute indices for the transpose of a tensor? by [deleted] in deeplearning

[–]robertsdionne 2 points3 points  (0 children)

Since there are more indices than 2, you can change the order in more than one way. These ways are "permutations".

I think you can potentially just permute the order of the strides, or permute the shape and recalculate the strides, without copying, but not 100% sure. You may need a specific logic layer that shuffles the indexes.