type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction |
()=> {
it("should invoke the JcadContextManager with the JarsConnectorRefs.DELETE_CONNECTOR_REF reference", function() {
sinon.assert.calledOnce(getContextSpy);
sinon.assert.calledWith(
getContextSpy, JarsConnectorRefs.DELETE_CONNECTOR_REF
);
});
it("should invoke the Decora... | jec-project/jec-jars | test/com/jec/jars/annotations/DELETETest.ts | TypeScript |
ArrowFunction |
(region: string, options?: any) => {
let regionInfo: RegionInfo | undefined = undefined;
switch (region) {
// First, try to match exact region names.
case "af-south-1":
regionInfo = {
hostname: "route53resolver.af-south-1.amazonaws.com",
partition: "aws",
};
break;
cas... | Acium-Global/aws-sdk-js-v3 | clients/client-route53resolver/endpoints.ts | TypeScript |
ArrowFunction |
() => {
const history = useHistory();
const location = useLocation();
const loadedUser = useSelector((state: ReduxState) => state.users.loadedUser);
const authenticated = useSelector((state: ReduxState) => state.users.authenticated);
const dispatch = useDispatch();
const dispatchLoadUser = React.useCallba... | Nashoba-EMS/emt-desktop | src/EntryPoint.tsx | TypeScript |
ArrowFunction |
(state: ReduxState) => state.users.loadedUser | Nashoba-EMS/emt-desktop | src/EntryPoint.tsx | TypeScript |
ArrowFunction |
(state: ReduxState) => state.users.authenticated | Nashoba-EMS/emt-desktop | src/EntryPoint.tsx | TypeScript |
ArrowFunction |
() => dispatch(_users.loadSession()) | Nashoba-EMS/emt-desktop | src/EntryPoint.tsx | TypeScript |
ArrowFunction |
() => {
if (!loadedUser) {
dispatchLoadUser();
} else {
if (!authenticated) {
history.push("/login");
} else if (location.pathname === "/login") {
history.push("/");
}
}
} | Nashoba-EMS/emt-desktop | src/EntryPoint.tsx | TypeScript |
ArrowFunction |
(a: Attachment) => a.type === attachmentType | navikt/foreldrepengesoknad | src/app/components/skjema/vedleggSpørsmål/VedleggSpørsmål.tsx | TypeScript |
ClassDeclaration |
class VedleggSpørsmål extends React.Component<Props> {
constructor(props: Props) {
super(props);
this.updateVedleggList = this.updateVedleggList.bind(this);
this.updateVedleggItem = this.updateVedleggItem.bind(this);
this.deleteVedleggItem = this.deleteVedleggItem.bind(this);
}
... | navikt/foreldrepengesoknad | src/app/components/skjema/vedleggSpørsmål/VedleggSpørsmål.tsx | TypeScript |
InterfaceDeclaration |
interface OwnProps {
vedlegg?: Attachment[];
attachmentType: AttachmentType;
onChange: (vedlegg: Attachment[]) => void;
skjemanummer: Skjemanummer;
intl: IntlShape;
} | navikt/foreldrepengesoknad | src/app/components/skjema/vedleggSpørsmål/VedleggSpørsmål.tsx | TypeScript |
TypeAliasDeclaration |
type Props = OwnProps; | navikt/foreldrepengesoknad | src/app/components/skjema/vedleggSpørsmål/VedleggSpørsmål.tsx | TypeScript |
MethodDeclaration |
updateVedleggItem(vedleggItem: Attachment) {
const { vedlegg } = this.props;
let vedleggList: Attachment[] = vedlegg || [];
const index = vedleggList.indexOf(vedleggItem);
if (index >= 0) {
vedleggList[index] = vedleggItem;
} else {
vedleggList = [vedlegg... | navikt/foreldrepengesoknad | src/app/components/skjema/vedleggSpørsmål/VedleggSpørsmål.tsx | TypeScript |
MethodDeclaration |
deleteVedleggItem(vedleggItem: Attachment) {
const { vedlegg } = this.props;
const vedleggList: Attachment[] = vedlegg || [];
const index = vedleggList.indexOf(vedleggItem);
vedleggList.splice(index, 1);
this.updateVedleggList(vedleggList);
} | navikt/foreldrepengesoknad | src/app/components/skjema/vedleggSpørsmål/VedleggSpørsmål.tsx | TypeScript |
MethodDeclaration |
updateVedleggList(vedlegg: Attachment[]) {
this.props.onChange(vedlegg);
} | navikt/foreldrepengesoknad | src/app/components/skjema/vedleggSpørsmål/VedleggSpørsmål.tsx | TypeScript |
MethodDeclaration |
render() {
const { vedlegg, skjemanummer, attachmentType } = this.props;
return (
<AttachmentsUploader
attachments={vedlegg ? vedlegg.filter((a: Attachment) => a.type === attachmentType) : []}
onFilesUploadStart={(nyeVedlegg) => {
this.upd... | navikt/foreldrepengesoknad | src/app/components/skjema/vedleggSpørsmål/VedleggSpørsmål.tsx | TypeScript |
FunctionDeclaration |
export function setStore(s: Store) {
store = s
const state = s.getState()
onStoreStartedListeners.forEach(l => l(state))
} | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
FunctionDeclaration |
export function onStoreStarted(l: (s: State) => void) {
onStoreStartedListeners.push(l)
} | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
FunctionDeclaration |
export function onAfterActionDispatch<T extends AllActions['type']>(type: T, listener: OnActionDispatchListener<T>) {
onAfterActionDispatchListeners.push({ type, listener })
} | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
FunctionDeclaration |
export function onBeforeActionDispatch<T extends AllActions['type']>(type: T, listener: OnActionDispatchListener<T>) {
onBeforeActionDispatchListeners.push({ type, listener })
} | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
FunctionDeclaration |
export function getState(): State {
return store.getState()
} | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
FunctionDeclaration |
export function dispatch(action: AllActions) {
const state = store.getState()
onBeforeActionDispatchListeners!.filter(i => i.type === action.type).forEach(l => l.listener(action, state))
store.dispatch(action)
const state2 = store.getState()
onAfterActionDispatchListeners!.filter(i => i.type === action.type)... | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
ArrowFunction |
l => l(state) | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
ArrowFunction |
i => i.type === action.type | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
ArrowFunction |
l => l.listener(action, state) | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
ArrowFunction |
l => l.listener(action, state2) | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
TypeAliasDeclaration |
export type ActionForType<T extends AllActions['type']> = AllActions extends infer R ? R extends AllActions ? T extends R['type'] ? R : never : never : never | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
TypeAliasDeclaration |
type OnActionDispatchListener<T extends AllActions['type']= AllActions['type']> = (action: ActionForType<T>, state: State) => void | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
TypeAliasDeclaration |
export type AllActions =
RequestCodeChangeAction | EditorModelChangedAction |
PushLogAction |
ChangeAutoApply | SelectExplorer | SetWorking |
ChangeThemeAction |
FetchCompiledAction | RenderCompiledAction | ErrorCompiledAction |
JSXColorsActions | cancerberoSgx/jsx-alone | jsx-explorer/src/store/store.ts | TypeScript |
FunctionDeclaration |
function createIntlMock() {
const intlProvider = new IntlProvider({ locale: 'en-US', messages: messagesMap['en-US'] }, {});
const { intl } = intlProvider.getChildContext();
return intl;
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
FunctionDeclaration |
function getResponse(response: string, delay: number): Promise<string> {
return new Promise((resolve) => {
setTimeout(() => resolve(response), delay);
});
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
FunctionDeclaration |
function fetchVisObject(uri: string): Promise<VisualizationObject.IVisualizationObject> {
const visObj = charts.find(chart => chart.visualizationObject.meta.uri === uri);
if (!visObj) {
throw new Error(`Unknown uri ${uri}`);
}
return Promise.resolve(visObj.visualizationObject);
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
FunctionDeclaration |
function fetchVisualizationClass(visualizationClassUri: string): Promise<VisualizationClass.IVisualizationClass> {
const visClass = visualizationClasses.find(vc => vc.visualizationClass.meta.uri === visualizationClassUri);
if (!visClass) {
throw new Error(`Unknown uri ${visualizationClassUri}`);
}... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
FunctionDeclaration | // tslint:disable-next-line:variable-name
function uriResolver(_projectId: string, uri: string, identifier: string): Promise<string> {
if (identifier === TABLE_IDENTIFIER || uri === TABLE_URI) {
return getResponse(TABLE_URI, FAST);
}
if (identifier === CHART_IDENTIFIER || uri === CHART_URI) {
... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
(resolve) => {
setTimeout(() => resolve(response), delay);
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => resolve(response) | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
chart => chart.visualizationObject.meta.uri === uri | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
vc => vc.visualizationClass.meta.uri === visualizationClassUri | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
it('should construct and provide intl', () => {
const wrapper = mount(
<Visualization
projectId={projectId}
identifier={CHART_IDENTIFIER}
fetchVisObject={fetchVisObject}
fetchVisualizationClass={fetchVisualizationClass}
... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = mount(
<Visualization
projectId={projectId}
identifier={CHART_IDENTIFIER}
fetchVisObject={fetchVisObject}
fetchVisualizationClass={fetchVisualizationClass}
uriResolver={uriResolver}
... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
expect(wrapper.find(IntlWrapper).length).toBe(1);
expect(wrapper.find(IntlVisualization).length).toBe(1);
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
const intl = createIntlMock();
it('should render chart', () => {
const wrapper = mount(
<VisualizationWrapped
projectId={projectId}
identifier={CHART_IDENTIFIER}
fetchVisObject={fetchVisObject}
fetchVisualizationClass=... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = mount(
<VisualizationWrapped
projectId={projectId}
identifier={CHART_IDENTIFIER}
fetchVisObject={fetchVisObject}
fetchVisualizationClass={fetchVisualizationClass}
uriResolver={uriResolver}
... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
expect(wrapper.find(BaseChart).length).toBe(1);
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = mount(
<VisualizationWrapped
projectId={projectId}
identifier={TABLE_IDENTIFIER}
fetchVisObject={fetchVisObject}
fetchVisualizationClass={fetchVisualizationClass}
uriResolver={uriResolver}
... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
expect(wrapper.find(SortableTable).length).toBe(1);
expect(wrapper.state('type')).toEqual(VisualizationTypes.TABLE);
expect(wrapper.state('dataSource')).not.toBeNull();
expect(wrapper.state('resultSpec')).toEqual(expectedResultSpec);
expect(wrapper.st... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = mount(
<VisualizationWrapped
projectId={projectId}
uri={CHART_URI}
fetchVisObject={fetchVisObject}
fetchVisualizationClass={fetchVisualizationClass}
uriResolver={uriResolver}
Base... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
(done) => {
const errorHandler = (value: { status: string }) => {
expect(value.status).toEqual(ErrorStates.NOT_FOUND);
done();
};
mount(
<VisualizationWrapped
projectId={projectId}
uri={'/invalid/url'}
onError=... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
(value: { status: string }) => {
expect(value.status).toEqual(ErrorStates.NOT_FOUND);
done();
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
// Response from first request comes back later that from the second one
const wrapper = mount(
<VisualizationWrapped
projectId={projectId}
identifier={CHART_IDENTIFIER}
uriResolver={uriResolver}
fetchVisObject={fetchVi... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
expect(wrapper.find(Table).length).toBe(1);
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = mount(
<VisualizationWrapped
projectId={projectId}
identifier={TABLE_IDENTIFIER}
uriResolver={uriResolver}
fetchVisObject={fetchVisObject}
fetchVisualizationClass={fetchVisualizationClass}
... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
expect(spy).not.toHaveBeenCalled();
spy.mockRestore();
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = mount(
<VisualizationWrapped
projectId={projectId}
identifier={TABLE_IDENTIFIER}
uriResolver={uriResolver}
fetchVisObject={fetchVisObject}
fetchVisualizationClass={fetchVisualizationClass}
... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
expect(wrapper.find(Table).length).toBe(1);
const TableElement = wrapper.find(Table).get(0);
expect(TableElement.props.LoadingComponent).toBe(LoadingComponent);
expect(TableElement.props.ErrorComponent).toBe(ErrorComponent);
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = mount(
<VisualizationWrapped
projectId={projectId}
identifier={CHART_IDENTIFIER}
uriResolver={uriResolver}
fetchVisObject={fetchVisObject}
fetchVisualizationClass={fetchVisualizationClass}
... | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
() => {
expect(wrapper.find(BaseChart).length).toBe(1);
const BaseChartElement = wrapper.find(BaseChart).get(0);
expect(BaseChartElement.props.LoadingComponent).toBe(LoadingComponent);
expect(BaseChartElement.props.ErrorComponent).toBe(ErrorComponent);
} | jakub-sterba/gooddata-react-components | src/components/uri/tests/Visualization.spec.tsx | TypeScript |
ArrowFunction |
async () => {
const a = tf.tensor1d([3, -1, 0, 100, -7, 2]);
const r = tf.max(a);
expectArraysClose(await r.data(), 100);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const a = tf.tensor1d([3, 3, 3]);
const r = tf.max(a);
expectArraysClose(await r.data(), 3);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const aData = new Float32Array(1000);
aData[0] = 1;
const a = tf.tensor1d(aData);
const r = tf.max(a);
expectArraysClose(await r.data(), 1);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
expectArraysClose(await tf.max([3, NaN, 2]).data(), NaN);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const a = tf.tensor2d([3, -1, 0, 100, -7, 2], [2, 3]);
expectArraysClose(await tf.max(a).data(), 100);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const a = tf.tensor2d([3, -1, 0, 100, -7, 2], [2, 3]);
expectArraysClose(await tf.max(a, [0, 1]).data(), 100);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const a = tf.tensor2d([3, -1, 0, 100, -7, 2], [2, 3]);
const r = tf.max(a, [0]);
expect(r.shape).toEqual([3]);
expectArraysClose(await r.data(), [100, -1, 2]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const a = tf.tensor2d([3, -1, 0, 100, -7, 2], [2, 3]);
const r = tf.max(a, [0], true /* keepDims */);
expect(r.shape).toEqual([1, 3]);
expectArraysClose(await r.data(), [100, -1, 2]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const a = tf.tensor2d([3, 2, 5, 100, -7, 2], [2, 3]);
const r = tf.max(a, 1);
expectArraysClose(await r.data(), [5, 100]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const a = tf.tensor2d([3, 2, 5, 100, -7, 2], [2, 3]);
const r = tf.max(a, -1);
expectArraysClose(await r.data(), [5, 100]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const a = tf.tensor2d([3, 2, 5, 100, -7, 2], [2, 3]);
const r = tf.max(a, [1]);
expectArraysClose(await r.data(), [5, 100]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const a = tf.range(0, 64).reshape([2, 2, 2, 2, 2, 2]);
const r = tf.max(a, [5]);
const expectedResult = [
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31,
33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63
];
expectArraysClose(await r.data(), exp... | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const input = tf.tensor2d([3, -1, 0, 100, -7, 2], [2, 3]);
const inputDataBefore = await input.data();
tf.max(input, [1, 0]);
const inputDataAfter = await input.data();
expectArraysClose(inputDataBefore, inputDataAfter);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
() => {
expect(() => tf.max({} as tf.Tensor))
.toThrowError(/Argument 'x' passed to 'max' must be a Tensor/);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
() => tf.max({} as tf.Tensor) | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const r = tf.max([3, -1, 0, 100, -7, 2]);
expectArraysClose(await r.data(), 100);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const a = tf.tensor2d([3, -1, 0, 100, -7, 2], [2, 3], 'int32');
expect(a.dtype).toEqual('int32');
expectArraysClose(await tf.max(a).data(), 100);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.scalar(42);
const dy = tf.scalar(-1);
const gradients = tf.grad(v => tf.max(v))(x, dy);
expectArraysClose(await gradients.data(), [-1]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
v => tf.max(v) | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.scalar(42);
const dy = tf.scalar(-1);
const gradients = tf.grad(v => tf.max(v.clone()).clone())(x, dy);
expectArraysClose(await gradients.data(), [-1]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
v => tf.max(v.clone()).clone() | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor1d([1, 3, 7, 7]);
const dy = tf.scalar(-1);
const gradients = tf.grad(v => tf.max(v))(x, dy);
expectArraysClose(await gradients.data(), [0, 0, -1, -1]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor2d([[0, 20, 10], [-10, -30, -20]]);
const dy = tf.tensor1d([-1, -1]);
const axis = -1;
const gradients = tf.grad(v => tf.max(v, axis))(x, dy);
expectArraysClose(await gradients.data(), [0, -1, 0, -1, 0, 0]);
expect(gradients.shape).toEqual([2, 3]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
v => tf.max(v, axis) | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor2d([[0, 20, 20], [-10, -30, -10]]);
const dy = tf.tensor1d([-1, -1]);
const axis = -1;
const gradients = tf.grad(v => tf.max(v, axis))(x, dy);
expectArraysClose(await gradients.data(), [0, -1, -1, -1, 0, -1]);
expect(gradients.shape).toEqual([2, 3]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor2d([[0, 20, 10], [-10, -30, 20]]);
const dy = tf.tensor1d([-1, -1, -1]);
const axis = 0;
const gradients = tf.grad(v => tf.max(v, axis))(x, dy);
expectArraysClose(await gradients.data(), [-1, -1, 0, 0, 0, -1]);
expect(gradients.shape).toEqual([2, 3]);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor2d([[0, 20, 10], [-10, -30, -20]]);
const dy = tf.tensor2d([[-1], [-1]]);
const axis = -1;
const keepDims = true;
const gradients = tf.grad(v => tf.max(v, axis, keepDims))(x, dy);
expectArraysClose(await gradients.data(), [0, -1, 0, -1, 0, 0]);
expect(gradie... | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
v => tf.max(v, axis, keepDims) | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor2d([[0, 20, 10], [-10, -30, 20]]);
const dy = tf.tensor2d([[-1, -1, -1]]);
const axis = 0;
const keepDims = true;
const gradients = tf.grad(v => tf.max(v, axis, keepDims))(x, dy);
expectArraysClose(await gradients.data(), [-1, -1, 0, 0, 0, -1]);
expect(gradi... | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.ones([2, 1, 250]);
const axis = 1;
const gradients = tf.grad(v => tf.max(v, axis))(x);
expect(gradients.shape).toEqual(x.shape);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor3d([[[0, 20], [10, 15]], [[-10, -30], [-20, -15]]]);
const dy = tf.tensor1d([-1, -1]);
const axis = [1, 2];
const gradients = tf.grad(v => tf.max(v, axis))(x, dy);
expectArraysClose(await gradients.data(), [0, -1, 0, 0, -1, 0, 0, 0]);
expect(gradients.shape).toE... | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor3d([[[0, 20], [20, 20]], [[-10, -30], [-10, -15]]]);
const dy = tf.tensor1d([-1, -1]);
const axis = [1, 2];
const gradients = tf.grad(v => tf.max(v, axis))(x, dy);
expectArraysClose(await gradients.data(), [0, -1, -1, -1, -1, 0, -1, 0]);
expect(gradients.shape).... | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor3d([[[0, 20], [10, 15]], [[-10, -30], [-20, -15]]]);
const dy = tf.tensor2d([[-1, -1], [-1, -1]]);
const axis = 2;
const gradients = tf.grad(v => tf.max(v, axis))(x, dy);
expectArraysClose(await gradients.data(), [0, -1, 0, -1, -1, 0, 0, -1]);
expect(gradients.s... | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor3d([[[0, 20], [10, 15]], [[-10, -30], [-20, -15]]]);
const dy = tf.tensor3d([[[-1], [-1]], [[-1], [-1]]]);
const axis = 2;
const keepDims = true;
const gradients = tf.grad(v => tf.max(v, axis, keepDims))(x, dy);
expectArraysClose(await gradients.data(), [0, -1, ... | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor4d([
[[[0, 20], [20, 20]], [[-10, -30], [-10, -30]]],
[[[0, -20], [-20, -20]], [[10, 30], [10, 30]]]
]);
const dy = tf.tensor1d([-1, -1]);
const axis = [1, 2, 3];
const gradients = tf.grad(v => tf.max(v, axis))(x, dy);
expectArraysClose(
awai... | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
async () => {
const x = tf.tensor4d([
[[[0, 20], [20, 20]], [[-10, -30], [-10, -30]]],
[[[0, -20], [-20, -20]], [[10, 30], [10, 30]]]
]);
const dy = tf.tensor4d([[[[-1]], [[-2]]], [[[-3]], [[-4]]]]);
const axis = [2, 3];
const keepDims = true;
const gradients = tf.grad(v => tf.max(v... | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
() => {
expect(() => tf.max(['a']))
.toThrowError(/Argument 'x' passed to 'max' must be numeric tensor/);
} | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
ArrowFunction |
() => tf.max(['a']) | AlexShafir/tfjs | tfjs-core/src/ops/max_test.ts | TypeScript |
InterfaceDeclaration |
export interface Student {
firstName:string;
lastName:string;
studentEmail:string;
course:string;
yearOfStudy: bigint;
registrationNumber:string;
} | vintage-coder/Event-Booking-System | EBSystemUI/src/app/Models/student.ts | TypeScript |
ClassDeclaration |
export default class GameNode {
id: string;
state: any;
} | thetinyspark/barista | dist/sdk/common/model/node/GameNode.d.ts | TypeScript |
ClassDeclaration |
export class AbstractTrieNode<T> implements TrieNode {
/**
* @override
*/
public kind: TrieNodeKind;
private children_: {[key: string]: TrieNode} = {};
/**
* @param constraint The constraint the node represents.
* @param test The constraint test of this node.
*/
constructor(
public cons... | zorkow/speech-rule-engine | ts/indexing/abstract_trie_node.ts | TypeScript |
ClassDeclaration |
export class StaticTrieNode extends AbstractTrieNode<Node> {
private rule_: SpeechRule|null = null;
/**
* @param constraint The constraint the node represents.
* @param test The constraint test of this node.
*/
constructor(constraint: string, test: ((p1: Node) => boolean)|null) {
super(constraint,... | zorkow/speech-rule-engine | ts/indexing/abstract_trie_node.ts | TypeScript |
MethodDeclaration | /**
* @override
*/
public getConstraint() {
return this.constraint;
} | zorkow/speech-rule-engine | ts/indexing/abstract_trie_node.ts | TypeScript |
MethodDeclaration | /**
* @override
*/
public getKind() {
return this.kind;
} | zorkow/speech-rule-engine | ts/indexing/abstract_trie_node.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.