小编Mat*_*gaj的帖子

在模板中输入对象会在 Angular 10 中给出错误“在初始化之前使用属性”

我有一堂课:

import * as p5 from 'p5';

export class Snake{
    constructor() { }

    sketch = (p: p5) => {
        p.setup = () => {
          ...
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我在 app.component 中创建它的实例,如下所示:

import { Component } from '@angular/core';
import { Snake } from './snake';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  snake = new Snake();
}
Run Code Online (Sandbox Code Playgroud)

然后我通过 app.component 的模板将这个实例输入到我的组件中:

<game [snake]=snake ></game>
Run Code Online (Sandbox Code Playgroud)

在组件中,我尝试像这样使用它:

import { Component, OnInit, Input } from '@angular/core';
import { Snake } from …
Run Code Online (Sandbox Code Playgroud)

typescript angular

6
推荐指数
1
解决办法
1万
查看次数

在 keras 中禁用张量流回溯警告

我已经创建了 keras 功能 API 模型,现在我正在尝试研究它的层输出,为从原始模型的输入开始到我选择的层结束的每一层创建子模型。我不明白在没有得到的情况下这样做的正确方法是什么

WARNING:tensorflow:11 out of the last 11 calls to 
<function Model.make_predict_function.<locals>.predict_function at 0x7fb8ebc92700> 
triggered tf.function retracing.
Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly 
in a loop, (2) passing tensors with different shapes, 
(3) passing Python objects instead of tensors. 
For (1), please define your @tf.function outside of the loop. 
For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes 
that can avoid unnecessary retracing. 
For (3), …
Run Code Online (Sandbox Code Playgroud)

python keras tensorflow

4
推荐指数
1
解决办法
2671
查看次数

使用 Spring Boot 和 JUnit5 在 Intellij 中终止所有测试

我试图用 JUnit5 在我的 Spring Boot 应用程序中编写一个简单的测试,我注意到我的所有测试都立即终止。我下载了一些单元测试示例,它工作得很好,所以我不知道我的设置有什么问题。

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringDemoApplication.class, args);
    }

}

Run Code Online (Sandbox Code Playgroud)

这是我终止的示例测试:

import org.junit.jupiter.api.Test;

class DemoClassTest {

    @Test
    void testOne() {

    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的 pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>SpringDemo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>SpringDemo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>14</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId> …
Run Code Online (Sandbox Code Playgroud)

java junit spring intellij-idea spring-boot

0
推荐指数
1
解决办法
1786
查看次数