waypipe works very fine.
def g():
print('HA')
return 7
def f(x=lazy: [g()]):
pass
^ Does that call g? def f(x=lazy: [g()]):
print(x)
^ How about now? def f(x=lazy: [g()]):
if False:
print(x)
^ How about now? def f(x=lazy: [g()]):
if random() > 42: # If random() returns a value from 0 to 1
print(x)
^ How about now? def f(x=lazy: [g()]):
if random() > 42:
print(x)
else:
print(x)
print(x)
^ How about now? And how often? def f(x=lazy: [g()]):
x = 3
if random() > 42:
print(x)
^ How about now? def f(x=None, x_defaulter=lambda: []):
x = x if x is not None else x_defaulter()
Or do it like a normal person: def f(x=None):
x = x if x is not None else []
Explicit is better than implicit. class A:
x = 3
y = x + 2
That now, x is a class variable (NOT an instance variable). And so is y. And the latter's value is 5. It doesn't try to second-guess whether you maybe mean any later value of x. No. The value of y is 5. a = A()
assert a.__class__.x == 3
assert a.x == 3
a.__class__.x = 10
b = A()
assert b.x == 10
succeeds. guix build --with-configure-flag="jq=CFLAGS=-O3" jq
If you want it to be permanent, then you can use a guix home profile (that's a declarative configuration of your home directory) with a patch function in the package list there: (define llama-tune
(options->transformation `((tune . "znver3")))) ; Zen 3
(home-environment
(packages (list (llama-tune (specification->package "llama")))))
or: (define jq-patch
(options->transformation `((with-configure-flag . "jq=CFLAGS=-O3"))))
[...] (jq-patch (specification->package "jq"))
[...] "Dev container: Docker from Docker Compose"
(keep in mind they worked before and I didn't change anything in vscode--I hadn't even run VSCode for 8 months or so) and when I try to fix that by clicking on the message in the extension manager the message immediately disappears from all 20 extensions in the manager (WTF?) and I get: $ cat a.pp
{$R+}
var
a: 1..12;
b: 1..12;
c: 1..12;
begin
a := 10;
b := 11;
c := a + b;
Writeln(c)
end.
$ fpc a.pp
Free Pascal Compiler version 3.2.2 [2021/05/19] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling a.pp
Linking a
12 lines compiled, 0.1 sec
$ ./a
Runtime error 201 at $00000000004010D8
$00000000004010D8
$0000000000422EEC x = tf.constant(([1, 2, 3, 4]))
tf.math.multiply(x, x)
<tf.Tensor: shape=(4,), dtype=..., numpy=array([ 1, 4, 9, 16], dtype=int32)>
I could stop right here since it's a counterexample to x being a matrix (with a matrix product defined on it; P.S. try tf.matmul(x, x)--it will fail; there's no .transpose either). But that's only technically correct :) import tensorflow as tf
# Initial outputs of one layer of nodes in your neural network
L1 = tf.constant([2.5, 4, 1.2], dtype=tf.float32)
# Our evil transformation matrix (coordinate system change)
A = tf.constant([[2, 0, 0], [0, 1, 0], [0, 0, 0.2]], dtype=tf.float32)
# Weights (no particular values; "random")
W12 = tf.constant(
[[-1, 0.4, 1.5],
[0.8, 0.5, 0.75],
[0.2, -0.3, 1]], dtype=tf.float32
)
# Covariant tensor nature; varying with the nodes
L1_covariant = tf.matmul(A, tf.reshape(L1, [3, 1]))
A_inverse = tf.linalg.inv(A)
# Contravariant tensor nature; varying against the nodes
W12_contravariant = tf.matmul(W12, A_inverse)
# Now derive the inputs for the next layer using the transformed node outputs and weights
L2 = tf.matmul(W12_contravariant, L1_covariant)
# Compare to the direct way
L2s = tf.matmul(W12, tf.reshape(L1, [3, 1]))
#assert L2 == L2s
A tensor (like a vector) is actually a very low-level object from the standpoint of linear algebra. It's not hard at all to make something a tensor. Think of it like geometric "assembly language".